[pve-devel] [PATCH RFC kernel] fix zpool import hang with nested pools

Fabian Grünbichler f.gruenbichler at proxmox.com
Tue Oct 25 16:10:02 CEST 2016


---
Note: I suggest waiting for feedback on the Ubuntu bug report before applying

 Makefile                                         |  1 +
 zfs-fix-zpool-import-bug-with-nested-pools.patch | 59 ++++++++++++++++++++++++
 2 files changed, 60 insertions(+)
 create mode 100644 zfs-fix-zpool-import-bug-with-nested-pools.patch

diff --git a/Makefile b/Makefile
index 90680ef..031d80e 100644
--- a/Makefile
+++ b/Makefile
@@ -351,6 +351,7 @@ ${SPL_MODULES}: .compile_mark ${SPLSRC}
 ${ZFS_MODULES}: .compile_mark ${ZFSSRC}
 	rm -rf ${ZFSDIR}
 	tar xf ${ZFSSRC}
+	cd ${ZFSDIR}; patch -p1 < ../zfs-fix-zpool-import-bug-with-nested-pools.patch
 	cd ${ZFSDIR}; ./autogen.sh
 	cd ${ZFSDIR}; ./configure --with-spl=${TOP}/${SPLDIR} --with-spl-obj=${TOP}/${SPLDIR} --with-config=kernel --with-linux=${TOP}/${KERNEL_SRC} --with-linux-obj=${TOP}/${KERNEL_SRC}
 	cd ${ZFSDIR}; make
diff --git a/zfs-fix-zpool-import-bug-with-nested-pools.patch b/zfs-fix-zpool-import-bug-with-nested-pools.patch
new file mode 100644
index 0000000..5e9a570
--- /dev/null
+++ b/zfs-fix-zpool-import-bug-with-nested-pools.patch
@@ -0,0 +1,59 @@
+From 188f526d43fabb89151f55955c93a910e9c26042 Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Fabian=20Gr=C3=BCnbichler?= <f.gruenbichler at proxmox.com>
+Date: Tue, 25 Oct 2016 13:49:17 +0200
+Subject: [PATCH] fix zpool import bug with nested pools
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+this was broken since Ubuntu-4.4.0-6.21, which contained
+
+193fb6a2c94fab8eb8ce70a5da4d21c7d4023bee UBUNTU: SAUCE: block_dev: Support checking inode permissions in lookup_bdev()
+
+without this fix, ZFS does not detect vdevs on zvols
+correctly, which causes a soft hang when importing zpools
+consisting of such vdevs.
+
+note the comment in module/zfs/vdev.c , 1141-1143:
+
+in order to handle pools on top of zvols, do the opens in a
+single thread so that the same thread holds the
+spa_namespace_lock
+
+BugLink: http://bugs.launchpad.net/bugs/1636517
+
+Signed-off-by: Fabian Grünbichler <f.gruenbichler at proxmox.com>
+---
+ config/kernel-lookup-bdev.m4 | 2 +-
+ module/zfs/zvol.c            | 2 +-
+ 2 files changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/config/kernel-lookup-bdev.m4 b/config/kernel-lookup-bdev.m4
+index 245f95f..123e238 100644
+--- a/config/kernel-lookup-bdev.m4
++++ b/config/kernel-lookup-bdev.m4
+@@ -7,7 +7,7 @@ AC_DEFUN([ZFS_AC_KERNEL_LOOKUP_BDEV],
+ 	ZFS_LINUX_TRY_COMPILE_SYMBOL([
+ 		#include <linux/fs.h>
+ 	], [
+-		lookup_bdev(NULL);
++		lookup_bdev(NULL, 0);
+ 	], [lookup_bdev], [fs/block_dev.c], [
+ 		AC_MSG_RESULT(yes)
+ 		AC_DEFINE(HAVE_LOOKUP_BDEV, 1, [lookup_bdev() is available])
+diff --git a/module/zfs/zvol.c b/module/zfs/zvol.c
+index 04f68b5..2fd8bb0 100644
+--- a/module/zfs/zvol.c
++++ b/module/zfs/zvol.c
+@@ -174,7 +174,7 @@ zvol_is_zvol(const char *device)
+ 	struct block_device *bdev;
+ 	unsigned int major;
+ 
+-	bdev = lookup_bdev(device);
++	bdev = lookup_bdev(device, 0);
+ 	if (IS_ERR(bdev))
+ 		return (B_FALSE);
+ 
+-- 
+2.1.4
+
-- 
2.1.4





More information about the pve-devel mailing list