From nobody@FreeBSD.org  Mon May 22 08:38:51 2006
Return-Path: <nobody@FreeBSD.org>
Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125])
	by hub.freebsd.org (Postfix) with ESMTP id 6C74916A41F
	for <freebsd-gnats-submit@FreeBSD.org>; Mon, 22 May 2006 08:38:51 +0000 (UTC)
	(envelope-from nobody@FreeBSD.org)
Received: from www.freebsd.org (www.freebsd.org [216.136.204.117])
	by mx1.FreeBSD.org (Postfix) with ESMTP id 22EC143D45
	for <freebsd-gnats-submit@FreeBSD.org>; Mon, 22 May 2006 08:38:51 +0000 (GMT)
	(envelope-from nobody@FreeBSD.org)
Received: from www.freebsd.org (localhost [127.0.0.1])
	by www.freebsd.org (8.13.1/8.13.1) with ESMTP id k4M8coCs010583
	for <freebsd-gnats-submit@FreeBSD.org>; Mon, 22 May 2006 08:38:50 GMT
	(envelope-from nobody@www.freebsd.org)
Received: (from nobody@localhost)
	by www.freebsd.org (8.13.1/8.13.1/Submit) id k4M8coZ9010577;
	Mon, 22 May 2006 08:38:50 GMT
	(envelope-from nobody)
Message-Id: <200605220838.k4M8coZ9010577@www.freebsd.org>
Date: Mon, 22 May 2006 08:38:50 GMT
From: Roman Petrukhine <roman@comstar.ru>
To: freebsd-gnats-submit@FreeBSD.org
Subject: FreeBSD 6.1-RELEASE  - "lockmgr: locking against myself"
X-Send-Pr-Version: www-2.3

>Number:         97595
>Category:       kern
>Synopsis:       [unionfs] FreeBSD 6.1-RELEASE  - "lockmgr: locking against myself"
>Confidential:   no
>Severity:       serious
>Priority:       low
>Responsible:    daichi
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Mon May 22 08:40:13 GMT 2006
>Closed-Date:    Tue Feb 13 06:05:39 GMT 2007
>Last-Modified:  Tue Feb 13 06:05:39 GMT 2007
>Originator:     Roman Petrukhine
>Release:        6.1-RELEASE
>Organization:
JSC "Comstar United Telesystems"
>Environment:
FreeBSD alnitak.comstar.ru 6.1-RELEASE FreeBSD 6.1-RELEASE #2: Mon May 22 10:48:26 MSD 2006     maxim@alnitak.comstar.ru:/usr/obj/usr/src/sys/Alnitak.kern  i386

>Description:
An attempt to use union_fs in 6.1-RELEASE
produce a  "panic: lockmgr: locking against myself".
I know about union_fs instability, but from early 4.x to 5.3-RELEASE 
all of this works fine and stable, and used by me to manage read-only system
binary tree under user's jails.


GNU gdb 6.1.1 [FreeBSD]
Copyright 2004 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB.  Type "show warranty" for details.
This GDB was configured as "i386-marcel-freebsd".

Unread portion of the kernel message buffer:
panic: lockmgr: locking against myself
cpuid = 0
Uptime: 1m34s
Dumping 2047 MB (2 chunks)
  chunk 0: 1MB (158 pages) ... ok
  chunk 1: 2047MB (524000 pages) 2031 2015 1999 1983 1967 1951 1935 1919 1903 1887 1871 1855 1839 1823 1807 1791 1775 1759 1743 1727 1711 1695 1679 1663 1647 1631 1615 1599 1583 1567 1551 1535 1519 1503 1487 1471 1455 1439 1423 1407 1391 1375 1359 1343 1327 1311 1295 1279 1263 1247 1231 1215 1199 1183 1167 1151 1135 1119 1103 1087 1071 1055 1039 1023 1007 991 975 959 943 927 911 895 879 863 847 831 815 799 783 767 751 735 719 703 687 671 655 639 623 607 591 575 559 543 527 511 495 479 463 447 431 415 399 383 367 351 335 319 303 287 271 255 239 223 207 191 175 159 143 127 111 95 79 63 47 31 15

#0  doadump () at pcpu.h:165
165             __asm __volatile("movl %%fs:0,%0" : "=r" (td));
(kgdb) where
#0  doadump () at pcpu.h:165
#1  0xc05001bd in boot (howto=260) at /usr/src/sys/kern/kern_shutdown.c:402
#2  0xc0500515 in panic (fmt=0xc06a424d "lockmgr: locking against myself")
    at /usr/src/sys/kern/kern_shutdown.c:558
#3  0xc04f4232 in lockmgr (lkp=0xc6aa2498, flags=12290, interlkp=0x80, td=0xc66d4180)
    at /usr/src/sys/kern/kern_lock.c:320
#4  0xc054f2ee in vop_stdlock (ap=0x0) at /usr/src/sys/kern/vfs_default.c:257
#5  0xc0685ddb in VOP_LOCK_APV (vop=0xc06dca80, a=0xe6b02aac) at vnode_if.c:1642
#6  0xc05658b0 in vn_lock (vp=0xc6aa2440, flags=4098, td=0xc66d4180) at vnode_if.h:844
#7  0xc0551130 in lookup (ndp=0xe6b02c00) at /usr/src/sys/kern/vfs_lookup.c:384
#8  0xc0550dc2 in namei (ndp=0xe6b02c00) at /usr/src/sys/kern/vfs_lookup.c:203
#9  0xc055f47d in kern_stat (td=0xc66d4180, path=0x0, pathseg=UIO_USERSPACE, sbp=0xe6b02c74)
    at /usr/src/sys/kern/vfs_syscalls.c:2076
#10 0xc055f42b in stat (td=0xc66d4180, uap=0xe6b02d04) at /usr/src/sys/kern/vfs_syscalls.c:2061
#11 0xc067436b in syscall (frame=
      {tf_fs = 59, tf_es = 59, tf_ds = -1078001605, tf_edi = -1077944224, tf_esi = 134648240, tf_ebp = -1077944072, tf_isp = -424661660, tf_ebx = 672066880, tf_edx = 134648064, tf_ecx = 134648245, tf_eax = 188, tf_trapno = 12, tf_err = 2, tf_eip = 673135243, tf_cs = 51, tf_eflags = 662, tf_esp = -1077945396, tf_ss = 59})
    at /usr/src/sys/i386/i386/trap.c:981
#12 0xc066122f in Xint0x80_syscall () at /usr/src/sys/i386/i386/exception.s:200
#13 0x00000033 in ?? ()
Previous frame inner to this frame (corrupt stack?)
(kgdb) backtrace
#0  doadump () at pcpu.h:165
#1  0xc05001bd in boot (howto=260) at /usr/src/sys/kern/kern_shutdown.c:402
#2  0xc0500515 in panic (fmt=0xc06a424d "lockmgr: locking against myself")
    at /usr/src/sys/kern/kern_shutdown.c:558
#3  0xc04f4232 in lockmgr (lkp=0xc6aa2498, flags=12290, interlkp=0x80, td=0xc66d4180)
    at /usr/src/sys/kern/kern_lock.c:320
#4  0xc054f2ee in vop_stdlock (ap=0x0) at /usr/src/sys/kern/vfs_default.c:257
#5  0xc0685ddb in VOP_LOCK_APV (vop=0xc06dca80, a=0xe6b02aac) at vnode_if.c:1642
#6  0xc05658b0 in vn_lock (vp=0xc6aa2440, flags=4098, td=0xc66d4180) at vnode_if.h:844
#7  0xc0551130 in lookup (ndp=0xe6b02c00) at /usr/src/sys/kern/vfs_lookup.c:384
#8  0xc0550dc2 in namei (ndp=0xe6b02c00) at /usr/src/sys/kern/vfs_lookup.c:203
#9  0xc055f47d in kern_stat (td=0xc66d4180, path=0x0, pathseg=UIO_USERSPACE, sbp=0xe6b02c74)
    at /usr/src/sys/kern/vfs_syscalls.c:2076
#10 0xc055f42b in stat (td=0xc66d4180, uap=0xe6b02d04) at /usr/src/sys/kern/vfs_syscalls.c:2061
#11 0xc067436b in syscall (frame=
      {tf_fs = 59, tf_es = 59, tf_ds = -1078001605, tf_edi = -1077944224, tf_esi = 134648240, tf_ebp = -1077944072, tf_isp = -424661660, tf_ebx = 672066880, tf_edx = 134648064, tf_ecx = 134648245, tf_eax = 188, tf_trapno = 12, tf_err = 2, tf_eip = 673135243, tf_cs = 51, tf_eflags = 662, tf_esp = -1077945396, tf_ss = 59})
    at /usr/src/sys/i386/i386/trap.c:981
#12 0xc066122f in Xint0x80_syscall () at /usr/src/sys/i386/i386/exception.s:200
#13 0x00000033 in ?? ()

#0  doadump () at pcpu.h:165
165             __asm __volatile("movl %%fs:0,%0" : "=r" (td));
(kgdb) up 
#1  0xc05001bd in boot (howto=260) at /usr/src/sys/kern/kern_shutdown.c:402
402                     doadump();
(kgdb) up 
#2  0xc0500515 in panic (fmt=0xc06a424d "lockmgr: locking against myself")
    at /usr/src/sys/kern/kern_shutdown.c:558
558             boot(bootopt);
(kgdb) 
#3  0xc04f4232 in lockmgr (lkp=0xc6aa2498, flags=12290, interlkp=0x80, td=0xc66d4180)
    at /usr/src/sys/kern/kern_lock.c:320
320                                     panic("lockmgr: locking against myself");
(kgdb) 
#4  0xc054f2ee in vop_stdlock (ap=0x0) at /usr/src/sys/kern/vfs_default.c:257
257             return (lockmgr(vp->v_vnlock, ap->a_flags, VI_MTX(vp), ap->a_td));
(kgdb) 
#5  0xc0685ddb in VOP_LOCK_APV (vop=0xc06dca80, a=0xe6b02aac) at vnode_if.c:1642
1642                    rc = vop->vop_lock(a);
(kgdb) 
#6  0xc05658b0 in vn_lock (vp=0xc6aa2440, flags=4098, td=0xc66d4180) at vnode_if.h:844
844             a.a_td = td;
(kgdb) 
#7  0xc0551130 in lookup (ndp=0xe6b02c00) at /usr/src/sys/kern/vfs_lookup.c:384
384             vn_lock(dp, cnp->cn_lkflags | LK_RETRY, td);
(kgdb) 
#8  0xc0550dc2 in namei (ndp=0xe6b02c00) at /usr/src/sys/kern/vfs_lookup.c:203
203                     error = lookup(ndp);
(kgdb) 
#9  0xc055f47d in kern_stat (td=0xc66d4180, path=0x0, pathseg=UIO_USERSPACE, sbp=0xe6b02c74)
    at /usr/src/sys/kern/vfs_syscalls.c:2076
2076            if ((error = namei(&nd)) != 0)
(kgdb) 
#10 0xc055f42b in stat (td=0xc66d4180, uap=0xe6b02d04) at /usr/src/sys/kern/vfs_syscalls.c:2061
2061            error = kern_stat(td, uap->path, UIO_USERSPACE, &sb);
(kgdb) 
#11 0xc067436b in syscall (frame=
      {tf_fs = 59, tf_es = 59, tf_ds = -1078001605, tf_edi = -1077944224, tf_esi = 134648240, tf_ebp = -1077944072, tf_isp = -424661660, tf_ebx = 672066880, tf_edx = 134648064, tf_ecx = 134648245, tf_eax = 188, tf_trapno = 12, tf_err = 2, tf_eip = 673135243, tf_cs = 51, tf_eflags = 662, tf_esp = -1077945396, tf_ss = 59})
    at /usr/src/sys/i386/i386/trap.c:981
981                     error = (*callp->sy_call)(td, args);
(kgdb) 
#12 0xc066122f in Xint0x80_syscall () at /usr/src/sys/i386/i386/exception.s:200
200             call    syscall
Current language:  auto; currently asm
(kgdb) 
#13 0x00000033 in ?? ()
(kgdb) 
Initial frame selected; you cannot go up.

>How-To-Repeat:
alnitak# cd /root/
alnitak# mkdir test
alnitak# cd test/
alnitak# mkdir a
alnitak# ln -s ./a/ ./b
alnitak# ls -la
total 6
drwxr-xr-x  3 root  wheel  512 May 22 12:04 .
drwxr-xr-x  4 root  wheel  512 May 22 12:04 ..
drwxr-xr-x  2 root  wheel  512 May 22 12:04 a
lrwxr-xr-x  1 root  wheel    4 May 22 12:04 b -> ./a/

alnitak# mount_unionfs -o rdonly /root/test/ /mnt
alnitak# mount
/dev/da0s1a on / (ufs, local)
devfs on /dev (devfs, local)
/dev/da0s1e on /usr (ufs, local, soft-updates)
/dev/da0s1f on /v0 (ufs, local, soft-updates)
/dev/da0s1d on /var (ufs, local, soft-updates)
<above>:/root/test on /mnt (unionfs, local, read-only, noclusterw)

alnitak# cd /mnt
alnitak# ls -la
total 6
drwxr-xr-x   5 root  wheel  512 May 22 12:04 .
drwxr-xr-x  20 root  wheel  512 May 18 15:23 ..
drwxr-xr-x   2 root  wheel  512 May 22 12:04 a
lrwxr-xr-x   1 root  wheel    4 May 22 12:04 b -> ./a/
alnitak# cd a
alnitak# ls
alnitak# cd ..
alnitak# cd b/

And the machine panic ...

>Fix:

>Release-Note:
>Audit-Trail:

From: Kris Kennaway <kris@obsecurity.org>
To: Roman Petrukhine <roman@comstar.ru>
Cc: freebsd-gnats-submit@FreeBSD.org
Subject: Re: kern/97595: FreeBSD 6.1-RELEASE - "lockmgr: locking against myself"
Date: Thu, 25 May 2006 04:39:00 -0400

 --MnLPg7ZWsaic7Fhd
 Content-Type: text/plain; charset=us-ascii
 Content-Disposition: inline
 Content-Transfer-Encoding: quoted-printable
 
 On Mon, May 22, 2006 at 08:38:50AM +0000, Roman Petrukhine wrote:
 
 > An attempt to use union_fs in 6.1-RELEASE
 > produce a  "panic: lockmgr: locking against myself".
 > I know about union_fs instability, but from early 4.x to 5.3-RELEASE=20
 > all of this works fine and stable, and used by me to manage read-only sys=
 tem
 > binary tree under user's jails.
 
 This will not be fixed as such, since the CVS implementation of
 unionfs is dead and broken.  However you should try the rewrite that
 is available as an uncommitted patch (search the fs@ mailing list
 archives), and report further problems to the authors.
 
 Kris
 
 --MnLPg7ZWsaic7Fhd
 Content-Type: application/pgp-signature
 Content-Disposition: inline
 
 -----BEGIN PGP SIGNATURE-----
 Version: GnuPG v1.4.3 (FreeBSD)
 
 iD8DBQFEdW0jWry0BWjoQKURAgW0AJ4vJKWzyPsYPaUoUrn8UHK6EF4jbwCgp152
 561+aMIbxBOrpv82/g4wBNE=
 =/6nX
 -----END PGP SIGNATURE-----
 
 --MnLPg7ZWsaic7Fhd--
State-Changed-From-To: open->suspended 
State-Changed-By: linimon 
State-Changed-When: Thu May 25 19:19:10 UTC 2006 
State-Changed-Why:  
Will probably only be fixed with the partial rewrite that is pending. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=97595 
Responsible-Changed-From-To: freebsd-bugs->daichi 
Responsible-Changed-By: rodrigc 
Responsible-Changed-When: Sun May 28 20:25:21 UTC 2006 
Responsible-Changed-Why:  
daichi is showing interet in unionfs 

http://www.freebsd.org/cgi/query-pr.cgi?pr=97595 
State-Changed-From-To: suspended->closed 
State-Changed-By: rodrigc 
State-Changed-When: Tue Feb 13 06:05:14 UTC 2007 
State-Changed-Why:  
New unionfs implementation has been committed to RELENG_6 and CURRENT. 
This bug report is only relevant to the previous version of unionfs. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=97595 
>Unformatted:
