Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit dd5f6279 authored by zhangyi (F)'s avatar zhangyi (F) Committed by Jan Kara
Browse files

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: default avatarzhangyi (F) <yi.zhang@huawei.com>
Signed-off-by: default avatarJan Kara <jack@suse.cz>
parent cb917757
Loading
Loading
Loading
Loading
+9 −2
Original line number Diff line number Diff line
@@ -644,8 +644,15 @@ int dquot_writeback_dquots(struct super_block *sb, int type)
			spin_unlock(&dq_list_lock);
			dqstats_inc(DQST_LOOKUPS);
			err = sb->dq_op->write_dquot(dquot);
			if (!ret && err)
			if (err) {
				/*
				 * Clear dirty bit anyway to avoid infinite
				 * loop here.
				 */
				clear_dquot_dirty(dquot);
				if (!ret)
					ret = err;
			}
			dqput(dquot);
			spin_lock(&dq_list_lock);
		}