Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 16 Mar 2003 00:36:41 +1100
From:      Tim Robbins <tjr@FreeBSD.ORG>
To:        FUJITA Kazutoshi <fujita@soum.co.jp>
Cc:        freebsd-current@FreeBSD.ORG
Subject:   Re: crash: lockmgr: locking against myself
Message-ID:  <20030316003641.A48585@dilbert.robbins.dropbear.id.au>
In-Reply-To: <20030315.202727.74753735.fujita@soum.co.jp>; from fujita@soum.co.jp on Sat, Mar 15, 2003 at 08:27:27PM %2B0900
References:  <20030315.202727.74753735.fujita@soum.co.jp>

next in thread | previous in thread | raw e-mail | index | archive | help
On Sat, Mar 15, 2003 at 08:27:27PM +0900, FUJITA Kazutoshi wrote:

> Hi,
> 
> My -CURRENT(2003/03/14) box crashes when I tried to mount UDF(DVD-RAM).
> 
> # mount -t udf -o ro /dev/acd0 /dvdram
[...]
> panic: lockmgr: locking against myself
[...]
> (kgdb) bt
[...]
> #10 0xc039bcbb in panic (fmt=0x0) at ../../../kern/kern_shutdown.c:528
> #11 0xc038e141 in lockmgr (lkp=0xc4bce1e0, flags=16973826, interlkp=0x1000000, 
>     td=0xc4a023c0) at ../../../kern/kern_lock.c:447
> #12 0xc03e93dc in vop_stdlock (ap=0x0) at ../../../kern/vfs_default.c:304
> #13 0xc03e9228 in vop_defaultop (ap=0x0) at ../../../kern/vfs_default.c:163
> #14 0xc03ffbde in vn_lock (vp=0xc4bce124, flags=131074, td=0xc4a023c0)
>     at vnode_if.h:990
> #15 0xc034e45c in udf_hashins (node=0xc4bd1000)
>     at ../../../fs/udf/udf_vnops.c:133
> #16 0xc034dea4 in udf_vget (mp=0xc4ae6c00, ino=139, flags=0, vpp=0xdd0c7af4)
>     at ../../../fs/udf/udf_vfsops.c:617
> #17 0xc034db7e in udf_root (mp=0xc4b44000, vpp=0x8b)
>     at ../../../fs/udf/udf_vfsops.c:505

It seems that udf_vget() calls udf_allocv(), which returns a locked vnode.
udf_vget() then calls udf_hashins(), which tries to lock the vnode again,
causing the "locking against myself" panic.

Here's a simple untested patch to try which makes udf_allocv() return
an unlocked vnode. I'm not sure whether the locking in udf_hashins()
is right.

Index: sys/fs/udf/udf_vnops.c
===================================================================
RCS file: /home/ncvs/src/sys/fs/udf/udf_vnops.c,v
retrieving revision 1.24
diff -u -r1.24 udf_vnops.c
--- sys/fs/udf/udf_vnops.c	3 Mar 2003 19:15:39 -0000	1.24
+++ sys/fs/udf/udf_vnops.c	15 Mar 2003 12:12:13 -0000
@@ -127,10 +127,10 @@
 
 	udfmp = node->udfmp;
 
+	vn_lock(node->i_vnode, LK_EXCLUSIVE | LK_RETRY, curthread);
 	mtx_lock(&udfmp->hash_mtx);
 	TAILQ_INSERT_TAIL(&udfmp->udf_tqh, node, tq);
 	mtx_unlock(&udfmp->hash_mtx);
-	vn_lock(node->i_vnode, LK_EXCLUSIVE | LK_RETRY, curthread);
 
 	return (0);
 }
@@ -161,7 +161,6 @@
 		return (error);
 	}
 
-	vn_lock(vp, LK_EXCLUSIVE | LK_RETRY, td);
 	*vpp = vp;
 	return (0);
 }



Tim

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-current" in the body of the message




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