aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorzhangyi (F) <yi.zhang@huawei.com>2017-11-01 06:40:45 -0400
committerJan Kara <jack@suse.cz>2017-11-01 09:42:57 -0400
commitdd5f6279732e8885061d7455b9d86fdcfdf7f183 (patch)
tree9e99d6577faa32f58a3b29178dc837320c9d0890
parentcb91775711b2f3f7adea8d33aa83104baf75ee07 (diff)
quota: fix potential infinite loop
In dquot_writeback_dquots(), we write back dquot from dirty dquots list. There is a potential infinite loop if ->write_dquot() failure and forget remove dquot from the list. This patch clear dirty bit anyway to avoid it. Signed-off-by: zhangyi (F) <yi.zhang@huawei.com> Signed-off-by: Jan Kara <jack@suse.cz>
-rw-r--r--fs/quota/dquot.c11
1 files changed, 9 insertions, 2 deletions
diff --git a/fs/quota/dquot.c b/fs/quota/dquot.c
index 50b0556a124f..f68397923ebb 100644
--- a/fs/quota/dquot.c
+++ b/fs/quota/dquot.c
@@ -644,8 +644,15 @@ int dquot_writeback_dquots(struct super_block *sb, int type)
644 spin_unlock(&dq_list_lock); 644 spin_unlock(&dq_list_lock);
645 dqstats_inc(DQST_LOOKUPS); 645 dqstats_inc(DQST_LOOKUPS);
646 err = sb->dq_op->write_dquot(dquot); 646 err = sb->dq_op->write_dquot(dquot);
647 if (!ret && err) 647 if (err) {
648 ret = err; 648 /*
649 * Clear dirty bit anyway to avoid infinite
650 * loop here.
651 */
652 clear_dquot_dirty(dquot);
653 if (!ret)
654 ret = err;
655 }
649 dqput(dquot); 656 dqput(dquot);
650 spin_lock(&dq_list_lock); 657 spin_lock(&dq_list_lock);
651 } 658 }