quota: Properly annotate i_dquot arrays with __rcu

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: b9ba6f94b2 ("quota: remove dqptr_sem")
Signed-off-by: Jan Kara <jack@suse.cz>
This commit is contained in:
Jan Kara 2024-02-06 15:08:19 +01:00
parent 179b8c97eb
commit ccb49011bb
16 changed files with 16 additions and 17 deletions

View File

@ -674,7 +674,7 @@ struct ext2_inode_info {
struct inode vfs_inode; struct inode vfs_inode;
struct list_head i_orphan; /* unlinked but open inodes */ struct list_head i_orphan; /* unlinked but open inodes */
#ifdef CONFIG_QUOTA #ifdef CONFIG_QUOTA
struct dquot *i_dquot[MAXQUOTAS]; struct dquot __rcu *i_dquot[MAXQUOTAS];
#endif #endif
}; };

View File

@ -320,7 +320,7 @@ static ssize_t ext2_quota_read(struct super_block *sb, int type, char *data, siz
static ssize_t ext2_quota_write(struct super_block *sb, int type, const char *data, size_t len, loff_t off); static ssize_t ext2_quota_write(struct super_block *sb, int type, const char *data, size_t len, loff_t off);
static int ext2_quota_on(struct super_block *sb, int type, int format_id, static int ext2_quota_on(struct super_block *sb, int type, int format_id,
const struct path *path); const struct path *path);
static struct dquot **ext2_get_dquots(struct inode *inode) static struct dquot __rcu **ext2_get_dquots(struct inode *inode)
{ {
return EXT2_I(inode)->i_dquot; return EXT2_I(inode)->i_dquot;
} }

View File

@ -1156,7 +1156,7 @@ struct ext4_inode_info {
tid_t i_datasync_tid; tid_t i_datasync_tid;
#ifdef CONFIG_QUOTA #ifdef CONFIG_QUOTA
struct dquot *i_dquot[MAXQUOTAS]; struct dquot __rcu *i_dquot[MAXQUOTAS];
#endif #endif
/* Precomputed uuid+inum+igen checksum for seeding inode checksums */ /* Precomputed uuid+inum+igen checksum for seeding inode checksums */

View File

@ -1600,7 +1600,7 @@ static ssize_t ext4_quota_write(struct super_block *sb, int type,
static int ext4_quota_enable(struct super_block *sb, int type, int format_id, static int ext4_quota_enable(struct super_block *sb, int type, int format_id,
unsigned int flags); unsigned int flags);
static struct dquot **ext4_get_dquots(struct inode *inode) static struct dquot __rcu **ext4_get_dquots(struct inode *inode)
{ {
return EXT4_I(inode)->i_dquot; return EXT4_I(inode)->i_dquot;
} }

View File

@ -829,7 +829,7 @@ struct f2fs_inode_info {
spinlock_t i_size_lock; /* protect last_disk_size */ spinlock_t i_size_lock; /* protect last_disk_size */
#ifdef CONFIG_QUOTA #ifdef CONFIG_QUOTA
struct dquot *i_dquot[MAXQUOTAS]; struct dquot __rcu *i_dquot[MAXQUOTAS];
/* quota space reservation, managed internally by quota code */ /* quota space reservation, managed internally by quota code */
qsize_t i_reserved_quota; qsize_t i_reserved_quota;

View File

@ -2768,7 +2768,7 @@ int f2fs_dquot_initialize(struct inode *inode)
return dquot_initialize(inode); return dquot_initialize(inode);
} }
static struct dquot **f2fs_get_dquots(struct inode *inode) static struct dquot __rcu **f2fs_get_dquots(struct inode *inode)
{ {
return F2FS_I(inode)->i_dquot; return F2FS_I(inode)->i_dquot;
} }

View File

@ -92,7 +92,7 @@ struct jfs_inode_info {
} link; } link;
} u; } u;
#ifdef CONFIG_QUOTA #ifdef CONFIG_QUOTA
struct dquot *i_dquot[MAXQUOTAS]; struct dquot __rcu *i_dquot[MAXQUOTAS];
#endif #endif
u32 dev; /* will die when we get wide dev_t */ u32 dev; /* will die when we get wide dev_t */
struct inode vfs_inode; struct inode vfs_inode;

View File

@ -824,7 +824,7 @@ static ssize_t jfs_quota_write(struct super_block *sb, int type,
return len - towrite; return len - towrite;
} }
static struct dquot **jfs_get_dquots(struct inode *inode) static struct dquot __rcu **jfs_get_dquots(struct inode *inode)
{ {
return JFS_IP(inode)->i_dquot; return JFS_IP(inode)->i_dquot;
} }

View File

@ -65,7 +65,7 @@ struct ocfs2_inode_info
tid_t i_sync_tid; tid_t i_sync_tid;
tid_t i_datasync_tid; tid_t i_datasync_tid;
struct dquot *i_dquot[MAXQUOTAS]; struct dquot __rcu *i_dquot[MAXQUOTAS];
}; };
/* /*

View File

@ -122,7 +122,7 @@ static int ocfs2_susp_quotas(struct ocfs2_super *osb, int unsuspend);
static int ocfs2_enable_quotas(struct ocfs2_super *osb); static int ocfs2_enable_quotas(struct ocfs2_super *osb);
static void ocfs2_disable_quotas(struct ocfs2_super *osb); static void ocfs2_disable_quotas(struct ocfs2_super *osb);
static struct dquot **ocfs2_get_dquots(struct inode *inode) static struct dquot __rcu **ocfs2_get_dquots(struct inode *inode)
{ {
return OCFS2_I(inode)->i_dquot; return OCFS2_I(inode)->i_dquot;
} }

View File

@ -998,8 +998,7 @@ EXPORT_SYMBOL(dqget);
static inline struct dquot __rcu **i_dquot(struct inode *inode) static inline struct dquot __rcu **i_dquot(struct inode *inode)
{ {
/* Force __rcu for now until filesystems are fixed */ return inode->i_sb->s_op->get_dquots(inode);
return (struct dquot __rcu **)inode->i_sb->s_op->get_dquots(inode);
} }
static int dqinit_needed(struct inode *inode, int type) static int dqinit_needed(struct inode *inode, int type)

View File

@ -97,7 +97,7 @@ struct reiserfs_inode_info {
struct rw_semaphore i_xattr_sem; struct rw_semaphore i_xattr_sem;
#endif #endif
#ifdef CONFIG_QUOTA #ifdef CONFIG_QUOTA
struct dquot *i_dquot[MAXQUOTAS]; struct dquot __rcu *i_dquot[MAXQUOTAS];
#endif #endif
struct inode vfs_inode; struct inode vfs_inode;

View File

@ -802,7 +802,7 @@ static ssize_t reiserfs_quota_write(struct super_block *, int, const char *,
static ssize_t reiserfs_quota_read(struct super_block *, int, char *, size_t, static ssize_t reiserfs_quota_read(struct super_block *, int, char *, size_t,
loff_t); loff_t);
static struct dquot **reiserfs_get_dquots(struct inode *inode) static struct dquot __rcu **reiserfs_get_dquots(struct inode *inode)
{ {
return REISERFS_I(inode)->i_dquot; return REISERFS_I(inode)->i_dquot;
} }

View File

@ -2159,7 +2159,7 @@ struct super_operations {
#ifdef CONFIG_QUOTA #ifdef CONFIG_QUOTA
ssize_t (*quota_read)(struct super_block *, int, char *, size_t, loff_t); ssize_t (*quota_read)(struct super_block *, int, char *, size_t, loff_t);
ssize_t (*quota_write)(struct super_block *, int, const char *, size_t, loff_t); ssize_t (*quota_write)(struct super_block *, int, const char *, size_t, loff_t);
struct dquot **(*get_dquots)(struct inode *); struct dquot __rcu **(*get_dquots)(struct inode *);
#endif #endif
long (*nr_cached_objects)(struct super_block *, long (*nr_cached_objects)(struct super_block *,
struct shrink_control *); struct shrink_control *);

View File

@ -37,7 +37,7 @@ struct shmem_inode_info {
unsigned int fsflags; /* for FS_IOC_[SG]ETFLAGS */ unsigned int fsflags; /* for FS_IOC_[SG]ETFLAGS */
atomic_t stop_eviction; /* hold when working on inode */ atomic_t stop_eviction; /* hold when working on inode */
#ifdef CONFIG_TMPFS_QUOTA #ifdef CONFIG_TMPFS_QUOTA
struct dquot *i_dquot[MAXQUOTAS]; struct dquot __rcu *i_dquot[MAXQUOTAS];
#endif #endif
struct inode vfs_inode; struct inode vfs_inode;
}; };

View File

@ -311,7 +311,7 @@ static void shmem_disable_quotas(struct super_block *sb)
dquot_quota_off(sb, type); dquot_quota_off(sb, type);
} }
static struct dquot **shmem_get_dquots(struct inode *inode) static struct dquot __rcu **shmem_get_dquots(struct inode *inode)
{ {
return SHMEM_I(inode)->i_dquot; return SHMEM_I(inode)->i_dquot;
} }