Whamcloud - gitweb
EX-4270 snapshot: avoid call quota op recursively
authorHongchao Zhang <hongchao@whamcloud.com>
Tue, 30 Nov 2021 10:11:01 +0000 (18:11 +0800)
committerAndreas Dilger <adilger@whamcloud.com>
Fri, 14 Jan 2022 06:07:58 +0000 (06:07 +0000)
In ext4_snapshot_test_and_cow, if there is already in some quota
call, it could cause deadlock if the snapshot calls quota function
to allocate space recursively.

[only the change to snapshot-jbd2-rhel7.7.patch]

Lustre-change: https://review.whamcloud.com/45680
Lustre-commit: 4722f1a0ca9d24bf6fa2678659ccf2cb1be5cdf1

Test-Parameters: trivial
Change-Id: Iac354744fcee8955d8e41020f9cee6d433f38e80
Signed-off-by: Hongchao Zhang <hongchao@whamcloud.com>
Reviewed-by: Li Dongyang <dongyangli@ddn.com>
Reviewed-by: Andreas Dilger <adilger@whamcloud.com>
Reviewed-on: https://review.whamcloud.com/46009
Tested-by: jenkins <devops@whamcloud.com>
Tested-by: Maloo <maloo@whamcloud.com>
Reviewed-by: Li Xi <lixi@ddn.com>
lustre/kernel_patches/patches/snapshot-jbd2-rhel7.7.patch

index 5aad4f3..149fda4 100644 (file)
@@ -1,7 +1,7 @@
 diff -p -u linux-3.10.0-1127.8.2.el7.x86_64/include/linux/jbd2.h linux-3.10.0-1127.8.2.el7.x86_64.snapshot/include/linux/jbd2.h
 --- linux-3.10.0-1127.8.2.el7.x86_64/include/linux/jbd2.h      2020-07-10 19:21:51.385885376 +0800
 +++ linux-3.10.0-1127.8.2.el7.x86_64.snapshot/include/linux/jbd2.h     2020-07-10 19:24:22.430382708 +0800
-@@ -448,6 +448,14 @@ struct jbd2_journal_handle
+@@ -448,6 +448,15 @@ struct jbd2_journal_handle
        unsigned long           h_start_jiffies;
        unsigned int            h_requested_credits;
  
@@ -11,7 +11,8 @@ diff -p -u linux-3.10.0-1127.8.2.el7.x86_64/include/linux/jbd2.h linux-3.10.0-11
 +      /* Number of buffers the user is allowed to dirty:
 +       * (counts only buffers dirtied when !h_cowing) */
 +      unsigned int    h_user_credits:14;
-+      unsigned int    h_cowing:1;     /* COWing block to snapshot */
++      unsigned int    h_cowing:1,     /* COWing block to snapshot */
++                      h_in_quota:1;   /* in quota call path */
 +
  #ifdef CONFIG_DEBUG_LOCK_ALLOC
        struct lockdep_map      h_lockdep_map;