Skip to content

Commit 42954c3

Browse files
jankaraSasha Levin
authored and
Sasha Levin
committedMar 26, 2024
quota: Properly annotate i_dquot arrays with __rcu
[ Upstream commit ccb4901 ] Dquots pointed to from i_dquot arrays in inodes are protected by dquot_srcu. Annotate them as such and change .get_dquots callback to return properly annotated pointer to make sparse happy. Fixes: b9ba6f9 ("quota: remove dqptr_sem") Signed-off-by: Jan Kara <jack@suse.cz> Signed-off-by: Sasha Levin <sashal@kernel.org>
1 parent e45e8aa commit 42954c3

File tree

16 files changed

+16
-17
lines changed

16 files changed

+16
-17
lines changed
 

‎fs/ext2/ext2.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -674,7 +674,7 @@ struct ext2_inode_info {
674674
struct inode vfs_inode;
675675
struct list_head i_orphan; /* unlinked but open inodes */
676676
#ifdef CONFIG_QUOTA
677-
struct dquot *i_dquot[MAXQUOTAS];
677+
struct dquot __rcu *i_dquot[MAXQUOTAS];
678678
#endif
679679
};
680680

‎fs/ext2/super.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -320,7 +320,7 @@ static ssize_t ext2_quota_read(struct super_block *sb, int type, char *data, siz
320320
static ssize_t ext2_quota_write(struct super_block *sb, int type, const char *data, size_t len, loff_t off);
321321
static int ext2_quota_on(struct super_block *sb, int type, int format_id,
322322
const struct path *path);
323-
static struct dquot **ext2_get_dquots(struct inode *inode)
323+
static struct dquot __rcu **ext2_get_dquots(struct inode *inode)
324324
{
325325
return EXT2_I(inode)->i_dquot;
326326
}

‎fs/ext4/ext4.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -1146,7 +1146,7 @@ struct ext4_inode_info {
11461146
tid_t i_datasync_tid;
11471147

11481148
#ifdef CONFIG_QUOTA
1149-
struct dquot *i_dquot[MAXQUOTAS];
1149+
struct dquot __rcu *i_dquot[MAXQUOTAS];
11501150
#endif
11511151

11521152
/* Precomputed uuid+inum+igen checksum for seeding inode checksums */

‎fs/ext4/super.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -1593,7 +1593,7 @@ static ssize_t ext4_quota_write(struct super_block *sb, int type,
15931593
static int ext4_quota_enable(struct super_block *sb, int type, int format_id,
15941594
unsigned int flags);
15951595

1596-
static struct dquot **ext4_get_dquots(struct inode *inode)
1596+
static struct dquot __rcu **ext4_get_dquots(struct inode *inode)
15971597
{
15981598
return EXT4_I(inode)->i_dquot;
15991599
}

‎fs/f2fs/f2fs.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -824,7 +824,7 @@ struct f2fs_inode_info {
824824
spinlock_t i_size_lock; /* protect last_disk_size */
825825

826826
#ifdef CONFIG_QUOTA
827-
struct dquot *i_dquot[MAXQUOTAS];
827+
struct dquot __rcu *i_dquot[MAXQUOTAS];
828828

829829
/* quota space reservation, managed internally by quota code */
830830
qsize_t i_reserved_quota;

‎fs/f2fs/super.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -2756,7 +2756,7 @@ int f2fs_dquot_initialize(struct inode *inode)
27562756
return dquot_initialize(inode);
27572757
}
27582758

2759-
static struct dquot **f2fs_get_dquots(struct inode *inode)
2759+
static struct dquot __rcu **f2fs_get_dquots(struct inode *inode)
27602760
{
27612761
return F2FS_I(inode)->i_dquot;
27622762
}

‎fs/jfs/jfs_incore.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ struct jfs_inode_info {
9292
} link;
9393
} u;
9494
#ifdef CONFIG_QUOTA
95-
struct dquot *i_dquot[MAXQUOTAS];
95+
struct dquot __rcu *i_dquot[MAXQUOTAS];
9696
#endif
9797
u32 dev; /* will die when we get wide dev_t */
9898
struct inode vfs_inode;

‎fs/jfs/super.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -824,7 +824,7 @@ static ssize_t jfs_quota_write(struct super_block *sb, int type,
824824
return len - towrite;
825825
}
826826

827-
static struct dquot **jfs_get_dquots(struct inode *inode)
827+
static struct dquot __rcu **jfs_get_dquots(struct inode *inode)
828828
{
829829
return JFS_IP(inode)->i_dquot;
830830
}

‎fs/ocfs2/inode.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ struct ocfs2_inode_info
6565
tid_t i_sync_tid;
6666
tid_t i_datasync_tid;
6767

68-
struct dquot *i_dquot[MAXQUOTAS];
68+
struct dquot __rcu *i_dquot[MAXQUOTAS];
6969
};
7070

7171
/*

‎fs/ocfs2/super.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ static int ocfs2_susp_quotas(struct ocfs2_super *osb, int unsuspend);
122122
static int ocfs2_enable_quotas(struct ocfs2_super *osb);
123123
static void ocfs2_disable_quotas(struct ocfs2_super *osb);
124124

125-
static struct dquot **ocfs2_get_dquots(struct inode *inode)
125+
static struct dquot __rcu **ocfs2_get_dquots(struct inode *inode)
126126
{
127127
return OCFS2_I(inode)->i_dquot;
128128
}

‎fs/quota/dquot.c

+1-2
Original file line numberDiff line numberDiff line change
@@ -1008,8 +1008,7 @@ EXPORT_SYMBOL(dqget);
10081008

10091009
static inline struct dquot __rcu **i_dquot(struct inode *inode)
10101010
{
1011-
/* Force __rcu for now until filesystems are fixed */
1012-
return (struct dquot __rcu **)inode->i_sb->s_op->get_dquots(inode);
1011+
return inode->i_sb->s_op->get_dquots(inode);
10131012
}
10141013

10151014
static int dqinit_needed(struct inode *inode, int type)

‎fs/reiserfs/reiserfs.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ struct reiserfs_inode_info {
9797
struct rw_semaphore i_xattr_sem;
9898
#endif
9999
#ifdef CONFIG_QUOTA
100-
struct dquot *i_dquot[MAXQUOTAS];
100+
struct dquot __rcu *i_dquot[MAXQUOTAS];
101101
#endif
102102

103103
struct inode vfs_inode;

‎fs/reiserfs/super.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -802,7 +802,7 @@ static ssize_t reiserfs_quota_write(struct super_block *, int, const char *,
802802
static ssize_t reiserfs_quota_read(struct super_block *, int, char *, size_t,
803803
loff_t);
804804

805-
static struct dquot **reiserfs_get_dquots(struct inode *inode)
805+
static struct dquot __rcu **reiserfs_get_dquots(struct inode *inode)
806806
{
807807
return REISERFS_I(inode)->i_dquot;
808808
}

‎include/linux/fs.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -2079,7 +2079,7 @@ struct super_operations {
20792079
#ifdef CONFIG_QUOTA
20802080
ssize_t (*quota_read)(struct super_block *, int, char *, size_t, loff_t);
20812081
ssize_t (*quota_write)(struct super_block *, int, const char *, size_t, loff_t);
2082-
struct dquot **(*get_dquots)(struct inode *);
2082+
struct dquot __rcu **(*get_dquots)(struct inode *);
20832083
#endif
20842084
long (*nr_cached_objects)(struct super_block *,
20852085
struct shrink_control *);

‎include/linux/shmem_fs.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ struct shmem_inode_info {
3232
struct timespec64 i_crtime; /* file creation time */
3333
unsigned int fsflags; /* flags for FS_IOC_[SG]ETFLAGS */
3434
#ifdef CONFIG_TMPFS_QUOTA
35-
struct dquot *i_dquot[MAXQUOTAS];
35+
struct dquot __rcu *i_dquot[MAXQUOTAS];
3636
#endif
3737
struct offset_ctx dir_offsets; /* stable entry offsets */
3838
struct inode vfs_inode;

‎mm/shmem.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -311,7 +311,7 @@ static void shmem_disable_quotas(struct super_block *sb)
311311
dquot_quota_off(sb, type);
312312
}
313313

314-
static struct dquot **shmem_get_dquots(struct inode *inode)
314+
static struct dquot __rcu **shmem_get_dquots(struct inode *inode)
315315
{
316316
return SHMEM_I(inode)->i_dquot;
317317
}

0 commit comments

Comments
 (0)