From owner-svn-src-head@FreeBSD.ORG Sat Nov 5 16:29:03 2011 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 814D3106566B; Sat, 5 Nov 2011 16:29:03 +0000 (UTC) (envelope-from pjd@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 70D548FC08; Sat, 5 Nov 2011 16:29:03 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id pA5GT3j5075555; Sat, 5 Nov 2011 16:29:03 GMT (envelope-from pjd@svn.freebsd.org) Received: (from pjd@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id pA5GT3tE075553; Sat, 5 Nov 2011 16:29:03 GMT (envelope-from pjd@svn.freebsd.org) Message-Id: <201111051629.pA5GT3tE075553@svn.freebsd.org> From: Pawel Jakub Dawidek Date: Sat, 5 Nov 2011 16:29:03 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r227110 - head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 05 Nov 2011 16:29:03 -0000 Author: pjd Date: Sat Nov 5 16:29:03 2011 New Revision: 227110 URL: http://svn.freebsd.org/changeset/base/227110 Log: 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 MFC after: 3 days Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zvol.c Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zvol.c ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zvol.c Sat Nov 5 16:04:57 2011 (r227109) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zvol.c Sat Nov 5 16:29:03 2011 (r227110) @@ -875,6 +875,14 @@ zvol_open(struct g_provider *pp, int fla 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 i not supported. + */ + return (EOPNOTSUPP); + } + mutex_enter(&spa_namespace_lock); zv = pp->private;