From: Jiang Biao benbjiang@tencent.com
stable inclusion from stable-v4.19.311 commit 1974c13019b97140149690cd622a9c6732c32124 category: bugfix bugzilla: https://gitee.com/openeuler/kernel/issues/IA8B9H CVE: NA
Reference: https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?id=...
--------------------------------
[ Upstream commit 78bc3334a69ff289dbc973a9db7c52a2d7757e5b ]
Local variable *reserved* of remove_dquot_ref() is only used if define CONFIG_QUOTA_DEBUG, but not ebraced in CONFIG_QUOTA_DEBUG macro, which leads to unused-but-set-variable warning when compiling.
This patch ebrace it into CONFIG_QUOTA_DEBUG macro like what is done in add_dquot_ref().
Signed-off-by: Jiang Biao benbjiang@tencent.com Signed-off-by: Jan Kara jack@suse.cz Stable-dep-of: 179b8c97ebf6 ("quota: Fix rcu annotations of inode dquot pointers") Signed-off-by: Sasha Levin sashal@kernel.org
Conflicts: fs/quota/dquot.c [Because commit 7bce48f0fec6 ("quota: simplify drop_dquot_ref()") was merged before this commit.] Signed-off-by: Baokun Li libaokun1@huawei.com --- fs/quota/dquot.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/fs/quota/dquot.c b/fs/quota/dquot.c index 2318e9aec408..645f49a484b3 100644 --- a/fs/quota/dquot.c +++ b/fs/quota/dquot.c @@ -1079,7 +1079,9 @@ static int add_dquot_ref(struct super_block *sb, int type) static void remove_dquot_ref(struct super_block *sb, int type) { struct inode *inode; +#ifdef CONFIG_QUOTA_DEBUG int reserved = 0; +#endif
spin_lock(&sb->s_inode_list_lock); list_for_each_entry(inode, &sb->s_inodes, i_sb_list) { @@ -1094,9 +1096,10 @@ static void remove_dquot_ref(struct super_block *sb, int type) struct dquot **dquots = i_dquot(inode); struct dquot *dquot = dquots[type];
+#ifdef CONFIG_QUOTA_DEBUG if (unlikely(inode_get_rsv_space(inode) > 0)) reserved = 1; - +#endif dquots[type] = NULL; if (dquot) dqput(dquot);