Re: ZFS regression: Giant lock held by kldload syscall (panic: witness_warn)

From: Kostik Belousov <kostikbel_at_gmail.com>
Date: Thu, 20 Aug 2009 12:22:05 +0300
On Wed, Aug 19, 2009 at 07:12:06PM -0700, Marcel Moolenaar wrote:
> 
> On Aug 19, 2009, at 6:53 PM, Marcel Moolenaar wrote:
> 
> >All,
> >
> >I can't boot with ZFS enabled on my ia64 box:
> 
> On top of that, the pool became unavailable. Importing the
> pool resulted in an immediate panic again:
> 
> hob# zpool import rel
> panic: mutex Giant owned at /nfs/freebsd/base/head/sys/kern/ 
> kern_exit.c:131
> cpuid = 0
> KDB: enter: panic
> [thread pid 1022 tid 100090 ]
> Stopped at      kdb_enter+0x92: [I2]    addl  
> r14=0xffffffffffe1c308,gp ;;
> db> bt
> Tracing pid 1022 tid 100090 td 0xe000000011567220
> kdb_enter(0xe0000000046dc040, 0xe0000000046dc040, 0xe000000004317870,  
> 0x793) at kdb_enter+0x92
> panic(0xe0000000046da148, 0xe0000000046da6b8, 0xe0000000046d5d28,  
> 0x83) at panic+0x2f0
> _mtx_assert(0xe000000004821188, 0x0, 0xe0000000046d5d28, 0x83,  
> 0xe0000000042c49f0) at _mtx_assert+0x200
> exit1(0xe000000011567220, 0x0, 0xe0000000042ded90, 0x48d) at exit1+0x40
> kproc_exit(0x0, 0xe0000000046d79b8, 0xe0000000117fa0f8,  
> 0xe0000000117fa000) at kproc_exit+0x130
> spa_async_thread(0xe000000011572000, 0x1, 0xe0000000046d5ff8, 0x33e)  
> at spa_async_thread+0x1a0
> fork_exit(0xe000000004794c20, 0xe000000011572000, 0xa0000000c5cbf550)  
> 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 = 1 (0xe000000004821188) locked  
> _at_ /nfs/freebsd/base/head/sys/kern/vfs_lookup.c:749
> 
> 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
_at__at_ -69,7 +69,7 _at__at_ kobj_open_file_vnode(const char *file)
 	struct thread *td = curthread;
 	struct filedesc *fd;
 	struct nameidata nd;
-	int error, flags;
+	int error, flags, vfslocked;
 
 	fd = td->td_proc->p_fd;
 	FILEDESC_XLOCK(fd);
_at__at_ -86,11 +86,13 _at__at_ kobj_open_file_vnode(const char *file)
 	flags = FREAD | O_NOFOLLOW;
 	NDINIT(&nd, LOOKUP, MPSAFE, UIO_SYSSPACE, file, td);
 	error = vn_open_cred(&nd, &flags, 0, 0, curthread->td_ucred, NULL);
-	NDFREE(&nd, NDF_ONLY_PNBUF);
 	if (error != 0)
 		return (NULL);
+	vfslocked = 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);
 }
 

Received on Thu Aug 20 2009 - 07:22:11 UTC

This archive was generated by hypermail 2.4.0 : Wed May 19 2021 - 11:39:54 UTC