all lists on lists.proxmox.com
 help / color / mirror / Atom feed
From: Stoiko Ivanov <s.ivanov@proxmox.com>
To: pve-devel@lists.proxmox.com
Subject: [pve-devel] [PATCH zfsonlinux 1/2] update submodule and patches to ZFS 2.1.3
Date: Fri, 11 Mar 2022 13:55:08 +0100	[thread overview]
Message-ID: <20220311125509.259035-2-s.ivanov@proxmox.com> (raw)
In-Reply-To: <20220311125509.259035-1-s.ivanov@proxmox.com>

Signed-off-by: Stoiko Ivanov <s.ivanov@proxmox.com>
---
 ...META-and-DCH-consistency-in-autoconf.patch |   4 +-
 debian/patches/0005-Enable-zed-emails.patch   |  17 +-
 ...md-unit-for-importing-specific-pools.patch |   2 +-
 .../0012-Fix-zvol_open-lock-inversion.patch   | 212 ------------------
 debian/patches/series                         |   1 -
 upstream                                      |   2 +-
 6 files changed, 8 insertions(+), 230 deletions(-)
 delete mode 100644 debian/patches/0012-Fix-zvol_open-lock-inversion.patch

diff --git a/debian/patches/0001-Check-for-META-and-DCH-consistency-in-autoconf.patch b/debian/patches/0001-Check-for-META-and-DCH-consistency-in-autoconf.patch
index c1f6a4bb..504bb998 100644
--- a/debian/patches/0001-Check-for-META-and-DCH-consistency-in-autoconf.patch
+++ b/debian/patches/0001-Check-for-META-and-DCH-consistency-in-autoconf.patch
@@ -10,7 +10,7 @@ Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
  1 file changed, 29 insertions(+), 5 deletions(-)
 
 diff --git a/config/zfs-meta.m4 b/config/zfs-meta.m4
-index b3c1befaa..660d8ccb9 100644
+index 20064a0fb..4d5f545ad 100644
 --- a/config/zfs-meta.m4
 +++ b/config/zfs-meta.m4
 @@ -1,9 +1,10 @@
@@ -67,4 +67,4 @@ index b3c1befaa..660d8ccb9 100644
 +		elif test ! -f ".nogitrelease" && git rev-parse --git-dir > /dev/null 2>&1; then
  			_match="${ZFS_META_NAME}-${ZFS_META_VERSION}"
  			_alias=$(git describe --match=${_match} 2>/dev/null)
- 			_release=$(echo ${_alias}|cut -f3- -d'-'|sed 's/-/_/g')
+ 			_release=$(echo ${_alias}|sed "s/${ZFS_META_NAME}//"|cut -f3- -d'-'|tr - _)
diff --git a/debian/patches/0005-Enable-zed-emails.patch b/debian/patches/0005-Enable-zed-emails.patch
index f605a356..a41693a0 100644
--- a/debian/patches/0005-Enable-zed-emails.patch
+++ b/debian/patches/0005-Enable-zed-emails.patch
@@ -9,23 +9,14 @@ behavior of mdadm.
 
 Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
 ---
- cmd/zed/zed.d/zed.rc | 4 ++--
- 1 file changed, 2 insertions(+), 2 deletions(-)
+ cmd/zed/zed.d/zed.rc | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
 
 diff --git a/cmd/zed/zed.d/zed.rc b/cmd/zed/zed.d/zed.rc
-index 1c278b2ef..41c075c09 100644
+index 9ac77f929..672617f54 100644
 --- a/cmd/zed/zed.d/zed.rc
 +++ b/cmd/zed/zed.d/zed.rc
-@@ -15,7 +15,7 @@
- # Email will only be sent if ZED_EMAIL_ADDR is defined.
- # Disabled by default; uncomment to enable.
- #
--#ZED_EMAIL_ADDR="root"
-+ZED_EMAIL_ADDR="root"
- 
- ##
- # Name or path of executable responsible for sending notifications via email;
-@@ -41,7 +41,7 @@
+@@ -41,7 +41,7 @@ ZED_EMAIL_ADDR="root"
  ##
  # Minimum number of seconds between notifications for a similar event.
  #
diff --git a/debian/patches/0008-Add-systemd-unit-for-importing-specific-pools.patch b/debian/patches/0008-Add-systemd-unit-for-importing-specific-pools.patch
index 98aaf020..4e7c288a 100644
--- a/debian/patches/0008-Add-systemd-unit-for-importing-specific-pools.patch
+++ b/debian/patches/0008-Add-systemd-unit-for-importing-specific-pools.patch
@@ -31,7 +31,7 @@ index e4056a92c..030611419 100644
  enable zfs-mount.service
  enable zfs-share.service
 diff --git a/etc/systemd/system/Makefile.am b/etc/systemd/system/Makefile.am
-index c374a52ac..25d1b99d7 100644
+index 5e65e1db4..8e6baeb68 100644
 --- a/etc/systemd/system/Makefile.am
 +++ b/etc/systemd/system/Makefile.am
 @@ -7,6 +7,7 @@ systemdunit_DATA = \
diff --git a/debian/patches/0012-Fix-zvol_open-lock-inversion.patch b/debian/patches/0012-Fix-zvol_open-lock-inversion.patch
deleted file mode 100644
index eb74550f..00000000
--- a/debian/patches/0012-Fix-zvol_open-lock-inversion.patch
+++ /dev/null
@@ -1,212 +0,0 @@
-From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
-From: Brian Behlendorf <behlendorf1@llnl.gov>
-Date: Fri, 17 Dec 2021 09:52:13 -0800
-Subject: [PATCH] Fix zvol_open() lock inversion
-
-When restructuring the zvol_open() logic for the Linux 5.13 kernel
-a lock inversion was accidentally introduced.  In the updated code
-the spa_namespace_lock is now taken before the zv_suspend_lock
-allowing the following scenario to occur:
-
-    down_read <=== waiting for zv_suspend_lock
-    zvol_open <=== holds spa_namespace_lock
-    __blkdev_get
-    blkdev_get_by_dev
-    blkdev_open
-    ...
-
-     mutex_lock <== waiting for spa_namespace_lock
-     spa_open_common
-     spa_open
-     dsl_pool_hold
-     dmu_objset_hold_flags
-     dmu_objset_hold
-     dsl_prop_get
-     dsl_prop_get_integer
-     zvol_create_minor
-     dmu_recv_end
-     zfs_ioc_recv_impl <=== holds zv_suspend_lock via zvol_suspend()
-     zfs_ioc_recv
-     ...
-
-This commit resolves the issue by moving the acquisition of the
-spa_namespace_lock back to after the zv_suspend_lock which restores
-the original ordering.
-
-Additionally, as part of this change the error exit paths were
-simplified where possible.
-
-Reviewed-by: Tony Hutter <hutter2@llnl.gov>
-Reviewed-by: Rich Ercolani <rincebrain@gmail.com>
-Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
-Closes #12863
-(cherry picked from commit 8a02d01e85556bbe3a1c6947bc11b8ef028d4023)
-Signed-off-by: Stoiko Ivanov <s.ivanov@proxmox.com>
----
- module/os/linux/zfs/zvol_os.c | 121 ++++++++++++++++------------------
- 1 file changed, 58 insertions(+), 63 deletions(-)
-
-diff --git a/module/os/linux/zfs/zvol_os.c b/module/os/linux/zfs/zvol_os.c
-index 44caadd58..69479b3f7 100644
---- a/module/os/linux/zfs/zvol_os.c
-+++ b/module/os/linux/zfs/zvol_os.c
-@@ -496,8 +496,7 @@ zvol_open(struct block_device *bdev, fmode_t flag)
- {
- 	zvol_state_t *zv;
- 	int error = 0;
--	boolean_t drop_suspend = B_TRUE;
--	boolean_t drop_namespace = B_FALSE;
-+	boolean_t drop_suspend = B_FALSE;
- #ifndef HAVE_BLKDEV_GET_ERESTARTSYS
- 	hrtime_t timeout = MSEC2NSEC(zvol_open_timeout_ms);
- 	hrtime_t start = gethrtime();
-@@ -517,7 +516,36 @@ retry:
- 		return (SET_ERROR(-ENXIO));
- 	}
- 
--	if (zv->zv_open_count == 0 && !mutex_owned(&spa_namespace_lock)) {
-+	mutex_enter(&zv->zv_state_lock);
-+	/*
-+	 * Make sure zvol is not suspended during first open
-+	 * (hold zv_suspend_lock) and respect proper lock acquisition
-+	 * ordering - zv_suspend_lock before zv_state_lock
-+	 */
-+	if (zv->zv_open_count == 0) {
-+		if (!rw_tryenter(&zv->zv_suspend_lock, RW_READER)) {
-+			mutex_exit(&zv->zv_state_lock);
-+			rw_enter(&zv->zv_suspend_lock, RW_READER);
-+			mutex_enter(&zv->zv_state_lock);
-+			/* check to see if zv_suspend_lock is needed */
-+			if (zv->zv_open_count != 0) {
-+				rw_exit(&zv->zv_suspend_lock);
-+			} else {
-+				drop_suspend = B_TRUE;
-+			}
-+		} else {
-+			drop_suspend = B_TRUE;
-+		}
-+	}
-+	rw_exit(&zvol_state_lock);
-+
-+	ASSERT(MUTEX_HELD(&zv->zv_state_lock));
-+
-+	if (zv->zv_open_count == 0) {
-+		boolean_t drop_namespace = B_FALSE;
-+
-+		ASSERT(RW_READ_HELD(&zv->zv_suspend_lock));
-+
- 		/*
- 		 * In all other call paths the spa_namespace_lock is taken
- 		 * before the bdev->bd_mutex lock.  However, on open(2)
-@@ -542,84 +570,51 @@ retry:
- 		 * the kernel so the only option is to return the error for
- 		 * the caller to handle it.
- 		 */
--		if (!mutex_tryenter(&spa_namespace_lock)) {
--			rw_exit(&zvol_state_lock);
-+		if (!mutex_owned(&spa_namespace_lock)) {
-+			if (!mutex_tryenter(&spa_namespace_lock)) {
-+				mutex_exit(&zv->zv_state_lock);
-+				rw_exit(&zv->zv_suspend_lock);
- 
- #ifdef HAVE_BLKDEV_GET_ERESTARTSYS
--			schedule();
--			return (SET_ERROR(-ERESTARTSYS));
--#else
--			if ((gethrtime() - start) > timeout)
-+				schedule();
- 				return (SET_ERROR(-ERESTARTSYS));
-+#else
-+				if ((gethrtime() - start) > timeout)
-+					return (SET_ERROR(-ERESTARTSYS));
- 
--			schedule_timeout(MSEC_TO_TICK(10));
--			goto retry;
-+				schedule_timeout(MSEC_TO_TICK(10));
-+				goto retry;
- #endif
--		} else {
--			drop_namespace = B_TRUE;
--		}
--	}
--
--	mutex_enter(&zv->zv_state_lock);
--	/*
--	 * make sure zvol is not suspended during first open
--	 * (hold zv_suspend_lock) and respect proper lock acquisition
--	 * ordering - zv_suspend_lock before zv_state_lock
--	 */
--	if (zv->zv_open_count == 0) {
--		if (!rw_tryenter(&zv->zv_suspend_lock, RW_READER)) {
--			mutex_exit(&zv->zv_state_lock);
--			rw_enter(&zv->zv_suspend_lock, RW_READER);
--			mutex_enter(&zv->zv_state_lock);
--			/* check to see if zv_suspend_lock is needed */
--			if (zv->zv_open_count != 0) {
--				rw_exit(&zv->zv_suspend_lock);
--				drop_suspend = B_FALSE;
-+			} else {
-+				drop_namespace = B_TRUE;
- 			}
- 		}
--	} else {
--		drop_suspend = B_FALSE;
--	}
--	rw_exit(&zvol_state_lock);
--
--	ASSERT(MUTEX_HELD(&zv->zv_state_lock));
- 
--	if (zv->zv_open_count == 0) {
--		ASSERT(RW_READ_HELD(&zv->zv_suspend_lock));
- 		error = -zvol_first_open(zv, !(flag & FMODE_WRITE));
--		if (error)
--			goto out_mutex;
--	}
- 
--	if ((flag & FMODE_WRITE) && (zv->zv_flags & ZVOL_RDONLY)) {
--		error = -EROFS;
--		goto out_open_count;
-+		if (drop_namespace)
-+			mutex_exit(&spa_namespace_lock);
- 	}
- 
--	zv->zv_open_count++;
--
--	mutex_exit(&zv->zv_state_lock);
--	if (drop_namespace)
--		mutex_exit(&spa_namespace_lock);
--	if (drop_suspend)
--		rw_exit(&zv->zv_suspend_lock);
--
--	zfs_check_media_change(bdev);
--
--	return (0);
-+	if (error == 0) {
-+		if ((flag & FMODE_WRITE) && (zv->zv_flags & ZVOL_RDONLY)) {
-+			if (zv->zv_open_count == 0)
-+				zvol_last_close(zv);
- 
--out_open_count:
--	if (zv->zv_open_count == 0)
--		zvol_last_close(zv);
-+			error = SET_ERROR(-EROFS);
-+		} else {
-+			zv->zv_open_count++;
-+		}
-+	}
- 
--out_mutex:
- 	mutex_exit(&zv->zv_state_lock);
--	if (drop_namespace)
--		mutex_exit(&spa_namespace_lock);
- 	if (drop_suspend)
- 		rw_exit(&zv->zv_suspend_lock);
- 
--	return (SET_ERROR(error));
-+	if (error == 0)
-+		zfs_check_media_change(bdev);
-+
-+	return (error);
- }
- 
- static void
diff --git a/debian/patches/series b/debian/patches/series
index 8166db91..d2770d39 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -9,4 +9,3 @@
 0009-Patch-move-manpage-arcstat-1-to-arcstat-8.patch
 0010-arcstat-Fix-integer-division-with-python3.patch
 0011-arc-stat-summary-guard-access-to-l2arc-MFU-MRU-stats.patch
-0012-Fix-zvol_open-lock-inversion.patch
diff --git a/upstream b/upstream
index af88d47f..ef83e07d 160000
--- a/upstream
+++ b/upstream
@@ -1 +1 @@
-Subproject commit af88d47f1ee86fae4abcfe0dabca67ea3c94d377
+Subproject commit ef83e07db53e5d1017d3afbf376f4dbb2f6feada
-- 
2.30.2





  reply	other threads:[~2022-03-11 12:55 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-03-11 12:55 [pve-devel] [PATCH zfsonlinux 0/2] update " Stoiko Ivanov
2022-03-11 12:55 ` Stoiko Ivanov [this message]
2022-03-11 12:55 ` [pve-devel] [PATCH zfsonlinux 2/2] add zfs-scrub timers+services to zfsutils-linux Stoiko Ivanov
2022-03-11 15:37 ` [pve-devel] applied-series: [PATCH zfsonlinux 0/2] update to ZFS 2.1.3 Thomas Lamprecht

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220311125509.259035-2-s.ivanov@proxmox.com \
    --to=s.ivanov@proxmox.com \
    --cc=pve-devel@lists.proxmox.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal