Re: contemporary -current panic: locking against myself

From: Dmitry Morozovsky <marck_at_rinet.ru>
Date: Sat, 4 Aug 2007 15:48:23 +0400 (MSD)
On Sat, 4 Aug 2007, Dmitry Morozovsky wrote:

DM> DM> PJD> Here you can find two patches, which may or may not fix your problem.
DM> DM> PJD> The first one is actually only to improve debug.
DM> DM> PJD> 
DM> DM> PJD> This patch adds all vnode flags to the output, because I believe you
DM> DM> PJD> have VI_OWEINACT set, but not printed:
DM> DM> PJD> 
DM> DM> PJD> 	http://people.freebsd.org/~pjd/patches/vfs_subr.c.4.patch
DM> DM> PJD> 
DM> DM> PJD> The problem here is that vm_object_reference() calls vget() without any
DM> DM> PJD> lock flag and vget() locks vnode exclusively when the VI_OWEINACT flag
DM> DM> PJD> is set. vget() should probably be fixed too, but jeff_at_ opinion is that
DM> DM> PJD> it shouldn't happen in this case, so this may be tmpfs bug.
DM> DM> PJD> 
DM> DM> PJD> The patch below fixes some locking problems in tmpfs:
DM> DM> PJD> 
DM> DM> PJD> 	http://people.freebsd.org/~pjd/patches/tmpfs.patch
DM> DM> PJD> 
DM> DM> PJD> The problems are:
DM> DM> PJD> - tmpfs_root() should honour 'flags' argument, and not always lock the
DM> DM> PJD>   vnode exclusively,
DM> DM> PJD> - tmpfs_lookup() should lock vnode using cnp->cn_lkflags, and not always
DM> DM> PJD>   do it exclusively,
DM> DM> PJD> - in ".." case when we unlock directory vnode to avoid deadlock, we
DM> DM> PJD>   should relock it using the same type of lock it was locked before and
DM> DM> PJD>   not always relock it exclusively,
DM> DM> PJD> 
DM> DM> PJD> Note, that this patch wasn't even compiled tested.
DM> DM> 
DM> DM> Well, it at least compiled and booted on i386. Test release run is in progress 
DM> DM> now, i'll followup with the results.
DM> 
DM> Good news: 
DM> 
DM> It fills 4G of RAM + 2G of swap, bailed out but not paniced. If the error is 
DM> not fixed, it at least well masked now. Please consider your patch for commit.
DM> 
DM> Thanks!

Bad news: after increasing swap to 16G (I had also increase maxswzone to 128M) 
it panics:

panic: lockmgr: locking against myself
cpuid = 1
KDB: enter: panic
[thread pid 93730 tid 100142 ]
Stopped at      kdb_enter+0x32: leave
db> wh
Tracing pid 93730 tid 100142 td 0xc65fc660
kdb_enter(c066f95e,1,c066dfa3,e6d279cc,1,...) at kdb_enter+0x32
panic(c066dfa3,e6d279dc,c0559ca7,e6d27ac0,c848d220,...) at panic+0x124
_lockmgr(c848d278,3002,c848d2a8,c65fc660,c0675df6,...) at _lockmgr+0x401
vop_stdlock(e6d27a5c,c65fc660,3002,c848d220,e6d27a80,...) at vop_stdlock+0x40
VOP_LOCK1_APV(c68a38a0,e6d27a5c,e6d27bc0,1,c6e3b110,...) at VOP_LOCK1_APV+0x46
_vn_lock(c848d220,3002,c65fc660,c0675df6,7f3,...) at _vn_lock+0x166
vget(c848d220,1000,c65fc660,0,e6d27b98,...) at vget+0x114
vm_object_reference(cefd57f8,e6d27b30,c063faad,c0c71000,e381f000,...) at 
vm_object_reference+0x12a
kern_execve(c65fc660,e6d27c5c,0,282053cc,28205480,e381f000,e381f000,e381f065,e381f54e,e385f000,3fab2,9,1f) 
at kern_execve+0x31a
execve(c65fc660,e6d27cfc,c,c65fc660,e6d27d2c,...) at execve+0x4c
syscall(e6d27d38) at syscall+0x345
Xint0x80_syscall() at Xint0x80_syscall+0x20
--- syscall (59, FreeBSD ELF32, execve), eip = 0x28146a47, esp = 0xbfbfe76c, 
ebp = 0xbfbfe788 ---
db> show lockedvnods
Locked vnodes

0xc848d220: tag tmpfs, type VREG
    usecount 1, writecount 0, refcount 4 mountedhere 0
    flags (VI_OWEINACT)
    v_object 0xcefd57f8 ref 1 pages 57
     lock type tmpfs: EXCL (count 1) by thread 0xc65fc660 (pid 93730) with 1 
pending
tag VT_TMPFS, tmpfs_node 0xd091d5c8, flags 0x0, links 1
        mode 0755, owner 0, group 0, size 664544, status 0x0

db>

Sincerely,
D.Marck                                     [DM5020, MCK-RIPE, DM3-RIPN]
[ FreeBSD committer:				      marck_at_FreeBSD.org ]
------------------------------------------------------------------------
*** Dmitry Morozovsky --- D.Marck --- Wild Woozle --- marck_at_rinet.ru ***
------------------------------------------------------------------------
Received on Sat Aug 04 2007 - 09:48:26 UTC

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