diff mbox

zfs: fix zpool import bug with nested pools

Message ID 1477404427-12265-1-git-send-email-f.gruenbichler@proxmox.com
State New
Headers show

Commit Message

Fabian Grünbichler Oct. 25, 2016, 2:07 p.m. UTC
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 zfs/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@proxmox.com>
---
fix tested with 4.4.0-45.66

note that instead of hardcoding the patched variant of lookup_bdev, it might
make sense to adapt the zfs automake files to autodetect and handle both one
parameter and two parameter variants?

that way, all three variations of building the zfs module would work and the
change could be proposed to upstream zfs:

dkms source with either an Ubuntu or upstream kernel Ubuntu kernel with zfs
module source in module/zfs/

 zfs/config/kernel-lookup-bdev.m4 | 2 +-
 zfs/module/zfs/zvol.c            | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

Comments

Tim Gardner Nov. 3, 2016, 10:01 p.m. UTC | #1
I think this has been superseded by
https://bugs.launchpad.net/ubuntu/+source/linux/+bug/1635656
Fabian Grünbichler Nov. 4, 2016, 6:49 a.m. UTC | #2
On Thu, Nov 03, 2016 at 04:01:21PM -0600, Tim Gardner wrote:
> I think this has been superseded by
> https://bugs.launchpad.net/ubuntu/+source/linux/+bug/1635656
> 

yes, that is correct!
diff mbox

Patch

diff --git a/zfs/config/kernel-lookup-bdev.m4 b/zfs/config/kernel-lookup-bdev.m4
index 245f95f..123e238 100644
--- a/zfs/config/kernel-lookup-bdev.m4
+++ b/zfs/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/zfs/module/zfs/zvol.c b/zfs/module/zfs/zvol.c
index 04f68b5..2fd8bb0 100644
--- a/zfs/module/zfs/zvol.c
+++ b/zfs/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);