]> git.itanic.dy.fi Git - linux-stable/commitdiff
quota: Properly annotate i_dquot arrays with __rcu
authorJan Kara <jack@suse.cz>
Tue, 6 Feb 2024 14:08:19 +0000 (15:08 +0100)
committerSasha Levin <sashal@kernel.org>
Tue, 26 Mar 2024 22:17:03 +0000 (18:17 -0400)
[ Upstream commit ccb49011bb2ebfd66164dbf68c5bff48917bb5ef ]

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: b9ba6f94b238 ("quota: remove dqptr_sem")
Signed-off-by: Jan Kara <jack@suse.cz>
Signed-off-by: Sasha Levin <sashal@kernel.org>
16 files changed:
fs/ext2/ext2.h
fs/ext2/super.c
fs/ext4/ext4.h
fs/ext4/super.c
fs/f2fs/f2fs.h
fs/f2fs/super.c
fs/jfs/jfs_incore.h
fs/jfs/super.c
fs/ocfs2/inode.h
fs/ocfs2/super.c
fs/quota/dquot.c
fs/reiserfs/reiserfs.h
fs/reiserfs/super.c
include/linux/fs.h
include/linux/shmem_fs.h
mm/shmem.c

index 677a9ad45dcb7afaaa18ee3c0e39c5f2799c0e78..f38bdd46e4f77fc4819a5705c252d6f05d4514a6 100644 (file)
@@ -674,7 +674,7 @@ struct ext2_inode_info {
        struct inode    vfs_inode;
        struct list_head i_orphan;      /* unlinked but open inodes */
 #ifdef CONFIG_QUOTA
-       struct dquot *i_dquot[MAXQUOTAS];
+       struct dquot __rcu *i_dquot[MAXQUOTAS];
 #endif
 };
 
index 01f9addc8b1f60ab0ae8533e3673baa38fdae934..6d8587505cea392d643c86825bc9328bb3bb5604 100644 (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 int ext2_quota_on(struct super_block *sb, int type, int format_id,
                         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;
 }
index 023571f8dd1b43887b691c4dd61742d07ac1b356..4fb938ba3f3597491e238292101cf37de6504f88 100644 (file)
@@ -1158,7 +1158,7 @@ struct ext4_inode_info {
        tid_t i_datasync_tid;
 
 #ifdef CONFIG_QUOTA
-       struct dquot *i_dquot[MAXQUOTAS];
+       struct dquot __rcu *i_dquot[MAXQUOTAS];
 #endif
 
        /* Precomputed uuid+inum+igen checksum for seeding inode checksums */
index 0f931d0c227daa8b00950667d8b8bb42a7a28a48..32bd83adf0bb8d00f80d3492526a3ab20319733e 100644 (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,
                             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;
 }
index 65294e3b0bef880a424c480ba4f4997b23c6b59c..31554e2a0a320eee1f28590b9bf1e582e5edc971 100644 (file)
@@ -829,7 +829,7 @@ struct f2fs_inode_info {
        spinlock_t i_size_lock;         /* protect last_disk_size */
 
 #ifdef CONFIG_QUOTA
-       struct dquot *i_dquot[MAXQUOTAS];
+       struct dquot __rcu *i_dquot[MAXQUOTAS];
 
        /* quota space reservation, managed internally by quota code */
        qsize_t i_reserved_quota;
index d45ab0992ae5947e6f89628e8e8829c548645d26..18cc4829f7e824e31049723e4f88be63f3f89243 100644 (file)
@@ -2768,7 +2768,7 @@ int f2fs_dquot_initialize(struct inode *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;
 }
index dd4264aa9beddecd58e17cd44a730d30acba4176..10934f9a11be32c8386ce7aeb4df889f08dd2fe3 100644 (file)
@@ -92,7 +92,7 @@ struct jfs_inode_info {
                } link;
        } u;
 #ifdef CONFIG_QUOTA
-       struct dquot *i_dquot[MAXQUOTAS];
+       struct dquot __rcu *i_dquot[MAXQUOTAS];
 #endif
        u32 dev;        /* will die when we get wide dev_t */
        struct inode    vfs_inode;
index 8d8e556bd6104eca1ec55d7ea4da3bcfec0c967f..ff135a43b5b7b90aea9e2450eab4153cc8b76978 100644 (file)
@@ -824,7 +824,7 @@ static ssize_t jfs_quota_write(struct super_block *sb, int type,
        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;
 }
index 82b28fdacc7e96a6d71027e3c9af8546853ecb44..accf03d4765ed9739fb93451f7edae9f647b6d23 100644 (file)
@@ -65,7 +65,7 @@ struct ocfs2_inode_info
        tid_t i_sync_tid;
        tid_t i_datasync_tid;
 
-       struct dquot *i_dquot[MAXQUOTAS];
+       struct dquot __rcu *i_dquot[MAXQUOTAS];
 };
 
 /*
index 6b906424902b46b9b17e1fb2102e916fcb89d1fc..1259fe02cd53b3756e7b6dc0d6a328c03da02f8d 100644 (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 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;
 }
index 3a16867a6fbde0a89880119232ab8d7e6c3d2a69..51ff554dc875ac2785bf6a4fc4fed3d46c83c66f 100644 (file)
@@ -1002,8 +1002,7 @@ EXPORT_SYMBOL(dqget);
 
 static inline struct dquot __rcu **i_dquot(struct inode *inode)
 {
-       /* Force __rcu for now until filesystems are fixed */
-       return (struct dquot __rcu **)inode->i_sb->s_op->get_dquots(inode);
+       return inode->i_sb->s_op->get_dquots(inode);
 }
 
 static int dqinit_needed(struct inode *inode, int type)
index 725667880e626a4577621c9137733340f0c53d30..b65549164590cdece80c681926a7efc055c6344a 100644 (file)
@@ -97,7 +97,7 @@ struct reiserfs_inode_info {
        struct rw_semaphore i_xattr_sem;
 #endif
 #ifdef CONFIG_QUOTA
-       struct dquot *i_dquot[MAXQUOTAS];
+       struct dquot __rcu *i_dquot[MAXQUOTAS];
 #endif
 
        struct inode vfs_inode;
index 67b5510beded2260b04c41bbd0247950784244dd..7b3d5aeb2a6fed6f4232a922a443ec7bb9bb624d 100644 (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,
                                   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;
 }
index 630468c005040f088d4a5ba1b893d467acb2d239..08ecac9d7b8bad3756fcf3a36444b5ca78212be9 100644 (file)
@@ -2158,7 +2158,7 @@ struct super_operations {
 #ifdef CONFIG_QUOTA
        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);
-       struct dquot **(*get_dquots)(struct inode *);
+       struct dquot __rcu **(*get_dquots)(struct inode *);
 #endif
        long (*nr_cached_objects)(struct super_block *,
                                  struct shrink_control *);
index 2caa6b86106aa368922335510f787df6e9f50766..66828dfc6e74e887bdcf302b651affff9bd40c49 100644 (file)
@@ -37,7 +37,7 @@ struct shmem_inode_info {
        unsigned int            fsflags;        /* for FS_IOC_[SG]ETFLAGS */
        atomic_t                stop_eviction;  /* hold when working on inode */
 #ifdef CONFIG_TMPFS_QUOTA
-       struct dquot            *i_dquot[MAXQUOTAS];
+       struct dquot __rcu      *i_dquot[MAXQUOTAS];
 #endif
        struct inode            vfs_inode;
 };
index d7c84ff621860b85090cf61d9b2970357da01b76..791a6dc163244be15ac799c16ce7ac9ad2e0baee 100644 (file)
@@ -311,7 +311,7 @@ static void shmem_disable_quotas(struct super_block *sb)
                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;
 }