From: Wang Shilong Date: Mon, 12 Apr 2021 08:43:22 +0000 (+0800) Subject: EX-2723 kernel: fix potential infinite loop X-Git-Url: https://git.whamcloud.com/?a=commitdiff_plain;h=0995f54cc21b49c0995fb4f6c888ce325d6cae13;p=fs%2Flustre-release.git EX-2723 kernel: 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. Snapshot destroy might dirty quota list, and umount will hang if filesystem has been mounted as RO because of corrupted image. Linux-commit: dd5f6279732e8885061d7455b9d86fdcfdf7f183 Change-Id: If5e9db82eacc3a6a621566fb612b55071e51da25 Signed-off-by: zhangyi (F) Signed-off-by: Jan Kara Signed-off-by: Wang Shilong Reviewed-on: https://review.whamcloud.com/43732 Tested-by: jenkins Reviewed-by: Wang Shilong Tested-by: Maloo Reviewed-by: Li Xi --- diff --git a/lustre/kernel_patches/patches/quota-fix-potential-infinite-loop-rhel7.patch b/lustre/kernel_patches/patches/quota-fix-potential-infinite-loop-rhel7.patch new file mode 100644 index 0000000..99018b8 --- /dev/null +++ b/lustre/kernel_patches/patches/quota-fix-potential-infinite-loop-rhel7.patch @@ -0,0 +1,41 @@ +From dd5f6279732e8885061d7455b9d86fdcfdf7f183 Mon Sep 17 00:00:00 2001 +From: "zhangyi (F)" +Date: Wed, 1 Nov 2017 18:40:45 +0800 +Subject: [PATCH] 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) +Signed-off-by: Jan Kara +--- + fs/quota/dquot.c | 11 +++++++++-- + 1 file changed, 9 insertions(+), 2 deletions(-) + +diff --git a/fs/quota/dquot.c b/fs/quota/dquot.c +index 50b0556..f683979 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) + spin_unlock(&dq_list_lock); + dqstats_inc(DQST_LOOKUPS); + err = sb->dq_op->write_dquot(dquot); +- if (!ret && err) +- 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); + } +-- +1.8.3.1 + diff --git a/lustre/kernel_patches/series/3.10-rhel7.9.series b/lustre/kernel_patches/series/3.10-rhel7.9.series index f6fdfdb..b44a770 100644 --- a/lustre/kernel_patches/series/3.10-rhel7.9.series +++ b/lustre/kernel_patches/series/3.10-rhel7.9.series @@ -11,3 +11,4 @@ virtio-fix-memory-leak-in-virtqueue_add.patch virtio_ring-add-a-vring_desc-reserve-mempool-rhel7.9.patch block-Ensure-we-only-enable-integrity-metadata-for-reads-and-writes-rhel7.patch snapshot-jbd2-rhel7.7.patch +quota-fix-potential-infinite-loop-rhel7.patch