sts-sponsors team mailing list archive
-
sts-sponsors team
-
Mailing list archive
-
Message #02637
[Merge] ~halves/ubuntu/+source/zfs-linux:lp1916486-bionic into ubuntu/+source/zfs-linux:ubuntu/bionic-devel
You have been requested to review the proposed merge of ~halves/ubuntu/+source/zfs-linux:lp1916486-bionic into ubuntu/+source/zfs-linux:ubuntu/bionic-devel.
For more details, see:
https://code.launchpad.net/~halves/ubuntu/+source/zfs-linux/+git/zfs-linux/+merge/398740
--
Your team STS Sponsors is requested to review the proposed merge of ~halves/ubuntu/+source/zfs-linux:lp1916486-bionic into ubuntu/+source/zfs-linux:ubuntu/bionic-devel.
diff --git a/debian/changelog b/debian/changelog
index d5514ac..5e166c3 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,11 @@
+zfs-linux (0.7.5-1ubuntu16.11) bionic; urgency=medium
+
+ * Fix race condition in zfs_iput_async (LP: #1916486)
+ - Upstream ZFS fix 43eaef6de817 ("Fix zrele race in zrele_async that can
+ cause hang")
+
+ -- Heitor Alves de Siqueira <halves@xxxxxxxxxxxxx> Thu, 25 Feb 2021 17:20:20 +0000
+
zfs-linux (0.7.5-1ubuntu16.10) bionic; urgency=medium
* Fix zfs-dkms build on arm64 with PREEMPTION and BLK_CGROUP (LP: #1892001)
diff --git a/debian/patches/fix-iput-race-in-zfs_iput_async.patch b/debian/patches/fix-iput-race-in-zfs_iput_async.patch
new file mode 100644
index 0000000..d83779d
--- /dev/null
+++ b/debian/patches/fix-iput-race-in-zfs_iput_async.patch
@@ -0,0 +1,52 @@
+From 43eaef6de817dab3e098488f8e02a11fe57944d0 Mon Sep 17 00:00:00 2001
+From: Paul Dagnelie <paulcd2000@xxxxxxxxx>
+Date: Wed, 27 Jan 2021 21:29:58 -0800
+Subject: [PATCH] Fix zrele race in zrele_async that can cause hang
+
+There is a race condition in zfs_zrele_async when we are checking if
+we would be the one to evict an inode. This can lead to a txg sync
+deadlock.
+
+Instead of calling into iput directly, we attempt to perform the atomic
+decrement ourselves, unless that would set the i_count value to zero.
+In that case, we dispatch a call to iput to run later, to prevent a
+deadlock from occurring.
+
+Reviewed-by: Brian Behlendorf <behlendorf1@xxxxxxxx>
+Reviewed-by: Matthew Ahrens <mahrens@xxxxxxxxxxx>
+Signed-off-by: Paul Dagnelie <pcd@xxxxxxxxxxx>
+Closes #11527
+Closes #11530
+
+Origin: backport, https://github.com/openzfs/zfs/commit/43eaef6de817
+Bug-Ubuntu: https://bugs.launchpad.net/bugs/1916486
+---
+ module/zfs/zfs_vnops.c | 13 +++++++++++++++++++---
+ 1 file changed, 10 insertions(+), 3 deletions(-)
+
+Index: zfs-linux/module/zfs/zfs_vnops.c
+===================================================================
+--- zfs-linux.orig/module/zfs/zfs_vnops.c
++++ zfs-linux/module/zfs/zfs_vnops.c
+@@ -958,11 +958,18 @@ zfs_iput_async(struct inode *ip)
+ ASSERT(atomic_read(&ip->i_count) > 0);
+ ASSERT(os != NULL);
+
+- if (atomic_read(&ip->i_count) == 1)
++ /*
++ * If decrementing the count would put us at 0, we can't do it inline
++ * here, because that would be synchronous. Instead, dispatch an iput
++ * to run later.
++ *
++ * For more information on the dangers of a synchronous iput, see the
++ * header comment of this file.
++ */
++ if (!atomic_add_unless(&ip->i_count, -1, 1)) {
+ VERIFY(taskq_dispatch(dsl_pool_iput_taskq(dmu_objset_pool(os)),
+ (task_func_t *)iput, ip, TQ_SLEEP) != TASKQID_INVALID);
+- else
+- iput(ip);
++ }
+ }
+
+ void
diff --git a/debian/patches/series b/debian/patches/series
index 4512ab1..3b348ac 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -96,3 +96,4 @@ enable-zed.patch
3321-add-compat-check-disk-size-change.patch
3322-add-scrub-compat-fixes.patch
4700-Fix-DKMS-build-on-arm64-with-PREEMPTION-and-BLK_CGRO.patch
+fix-iput-race-in-zfs_iput_async.patch
Follow ups