From 1519148e0b0543869b156b9a9707b0f8acedb7ec Mon Sep 17 00:00:00 2001 From: pjd Date: Thu, 24 Nov 2011 07:39:01 +0000 Subject: [PATCH] MFC r227110,r227111: r227110: In zvol_open() if the spa_namespace_lock is already held, it means that ZFS is trying to open and taste ZVOL as its VDEV. This is not supported, so return an error instead of panicing on spa_namespace_lock recursion. Reported by: Robert Millan PR: kern/162008 r227111: Correct typo in comment. Reported by: Fabian Keil Approved by: re (kib) git-svn-id: svn://svn.freebsd.org/base/releng/9.0@227927 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f --- sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zvol.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zvol.c b/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zvol.c index a14a9fe5..d22edbfe 100644 --- a/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zvol.c +++ b/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zvol.c @@ -875,6 +875,14 @@ zvol_open(struct g_provider *pp, int flag, int count) zvol_state_t *zv; int err = 0; + if (MUTEX_HELD(&spa_namespace_lock)) { + /* + * If the spa_namespace_lock is being held, it means that ZFS + * is trying to open ZVOL as its VDEV. This is not supported. + */ + return (EOPNOTSUPP); + } + mutex_enter(&spa_namespace_lock); zv = pp->private; -- 2.45.0