Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 20 Aug 2009 12:22:05 +0300
From:      Kostik Belousov <kostikbel@gmail.com>
To:        Marcel Moolenaar <xcllnt@mac.com>
Cc:        FreeBSD Current <freebsd-current@freebsd.org>
Subject:   Re: ZFS regression: Giant lock held by kldload syscall (panic: witness_warn)
Message-ID:  <20090820092205.GN9623@deviant.kiev.zoral.com.ua>
In-Reply-To: <5E3EBBE8-4A7D-4335-B814-8E70EA1CC81B@mac.com>
References:  <6359C817-0D09-4BBC-95A3-5F9226EA8706@mac.com> <5E3EBBE8-4A7D-4335-B814-8E70EA1CC81B@mac.com>

next in thread | previous in thread | raw e-mail | index | archive | help

--0yP1TEATOxPughaP
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

On Wed, Aug 19, 2009 at 07:12:06PM -0700, Marcel Moolenaar wrote:
>=20
> On Aug 19, 2009, at 6:53 PM, Marcel Moolenaar wrote:
>=20
> >All,
> >
> >I can't boot with ZFS enabled on my ia64 box:
>=20
> On top of that, the pool became unavailable. Importing the
> pool resulted in an immediate panic again:
>=20
> hob# zpool import rel
> panic: mutex Giant owned at /nfs/freebsd/base/head/sys/kern/=20
> kern_exit.c:131
> cpuid =3D 0
> KDB: enter: panic
> [thread pid 1022 tid 100090 ]
> Stopped at      kdb_enter+0x92: [I2]    addl =20
> r14=3D0xffffffffffe1c308,gp ;;
> db> bt
> Tracing pid 1022 tid 100090 td 0xe000000011567220
> kdb_enter(0xe0000000046dc040, 0xe0000000046dc040, 0xe000000004317870, =20
> 0x793) at kdb_enter+0x92
> panic(0xe0000000046da148, 0xe0000000046da6b8, 0xe0000000046d5d28, =20
> 0x83) at panic+0x2f0
> _mtx_assert(0xe000000004821188, 0x0, 0xe0000000046d5d28, 0x83, =20
> 0xe0000000042c49f0) at _mtx_assert+0x200
> exit1(0xe000000011567220, 0x0, 0xe0000000042ded90, 0x48d) at exit1+0x40
> kproc_exit(0x0, 0xe0000000046d79b8, 0xe0000000117fa0f8, =20
> 0xe0000000117fa000) at kproc_exit+0x130
> spa_async_thread(0xe000000011572000, 0x1, 0xe0000000046d5ff8, 0x33e) =20
> at spa_async_thread+0x1a0
> fork_exit(0xe000000004794c20, 0xe000000011572000, 0xa0000000c5cbf550) =20
> at fork_exit+0x110
> enter_userland() at enter_userland
> db> show alllocks
> Process 1022 (solthread 0xe000000) thread 0xe000000011567220 (100090)
> exclusive sleep mutex Giant (Giant) r =3D 1 (0xe000000004821188) locked =
=20
> @ /nfs/freebsd/base/head/sys/kern/vfs_lookup.c:749
>=20
> Something likes Giant and can't just let go...

Please try this patch.

diff --git a/sys/cddl/compat/opensolaris/kern/opensolaris_kobj.c b/sys/cddl=
/compat/opensolaris/kern/opensolaris_kobj.c
index c214488..d794345 100644
--- a/sys/cddl/compat/opensolaris/kern/opensolaris_kobj.c
+++ b/sys/cddl/compat/opensolaris/kern/opensolaris_kobj.c
@@ -69,7 +69,7 @@ kobj_open_file_vnode(const char *file)
 	struct thread *td =3D curthread;
 	struct filedesc *fd;
 	struct nameidata nd;
-	int error, flags;
+	int error, flags, vfslocked;
=20
 	fd =3D td->td_proc->p_fd;
 	FILEDESC_XLOCK(fd);
@@ -86,11 +86,13 @@ kobj_open_file_vnode(const char *file)
 	flags =3D FREAD | O_NOFOLLOW;
 	NDINIT(&nd, LOOKUP, MPSAFE, UIO_SYSSPACE, file, td);
 	error =3D vn_open_cred(&nd, &flags, 0, 0, curthread->td_ucred, NULL);
-	NDFREE(&nd, NDF_ONLY_PNBUF);
 	if (error !=3D 0)
 		return (NULL);
+	vfslocked =3D NDHASGIANT(&nd);
+	NDFREE(&nd, NDF_ONLY_PNBUF);
 	/* We just unlock so we hold a reference. */
 	VOP_UNLOCK(nd.ni_vp, 0);
+	VFS_UNLOCK_GIANT(vfslocked);
 	return (nd.ni_vp);
 }
=20

--0yP1TEATOxPughaP
Content-Type: application/pgp-signature
Content-Disposition: inline

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (FreeBSD)

iEYEARECAAYFAkqNFbwACgkQC3+MBN1Mb4jV7QCgmHk75NuFb7eqB7ugDt7R3Ql+
A4IAn0IOFyHVOERz812udk50VSX7x8Us
=31Ed
-----END PGP SIGNATURE-----

--0yP1TEATOxPughaP--



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20090820092205.GN9623>