panic: lockmgr: locking against myself

From: Marcel Moolenaar <marcel_at_xcllnt.net>
Date: Fri, 1 Jul 2005 17:26:48 -0700
When writing to a file across NFS and reading from it at the same time,
like:
	make >& make.out &
	tail -f make.out

You invariably get:

panic: lockmgr: locking against myself
KDB: enter: panic
[thread pid 1115 tid 100076 ]
Stopped at      kdb_enter+0x30: leave
db> wh
Tracing pid 1115 tid 100076 td 0xc18abd80
kdb_enter(c071c9c5,c0772140,c071b5e6,d5313994,100) at kdb_enter+0x30
panic(c071b5e6,0,d53139ec,c0644442,c18abd80) at panic+0xd5
lockmgr(c1c969e8,3001,c1c96a0c,c18abd80,d53139e8) at lockmgr+0x42d
vop_stdlock(d5313a18,0,1001,c1c96990,d5313a34) at vop_stdlock+0x2f
VOP_LOCK_APV(c075ab20,d5313a18,6,0,c18abd80) at VOP_LOCK_APV+0x54
vn_lock(c1c96990,1001,c18abd80,0,0) at vn_lock+0x13c
filt_vfsread(c1a0ac38,6,c075ab20,c1c96990,d5313bf8) at filt_vfsread+0x4a
knote(c1ca3030,6,0,23c,23c) at knote+0xff
VOP_WRITE_APV(c075ab20,d5313bf8,c18abd80,d5313bd8,0) at 
VOP_WRITE_APV+0x16a
vn_write(c1980cf0,d5313c6c,c1a83b00,0,c18abd80) at vn_write+0x240
dofilewrite(c18abd80,c1980cf0,1,806c400,6) at dofilewrite+0xcb
write(c18abd80,d5313d04,c,c18abd80,7) at write+0x69
syscall(3b,806003b,bfbf003b,0,806c400) at syscall+0x370
Xint0x80_syscall() at Xint0x80_syscall+0x1f
--- syscall (4, FreeBSD ELF32, write), eip = 0x2812c80f, esp = 
0xbfbfd6ac, ebp = 0xbfbfd6c8 ---
db> show lockedvnods
Locked vnodes

0xc1ad7440: tag nfs, type VDIR
     usecount 8, writecount 0, refcount 15 mountedhere 0
     flags ()
     v_object 0xc1b30084 ref 0 pages 5
      lock type nfs: EXCL (count 1) by thread 0xc1aa6600 (pid 1382)
         fileid 10011423 fsid 0x400ff02

0xc1c96990: tag nfs, type VREG
     usecount 2, writecount 1, refcount 4 mountedhere 0
     flags ()
     v_object 0xc1c897bc ref 0 pages 1
      lock type nfs: EXCL (count 1) by thread 0xc18abd80 (pid 1115)
         fileid 10669154 fsid 0x400ff02

========

(kgdb) bt
#0  doadump () at pcpu.h:165
#1  0xc0557525 in boot (howto=260) at 
/nfs/freebsd/6.x/src/sys/kern/kern_shutdown.c:397
#2  0xc055789d in panic (fmt=0xc071b5e6 "lockmgr: locking against 
myself") at /nfs/freebsd/6.x/src/sys/kern/kern_shutdown.c:553
#3  0xc0548cad in lockmgr (lkp=0xc1c969e8, flags=12290, interlkp=0x80, 
td=0xc18abd80) at /nfs/freebsd/6.x/src/sys/kern/kern_lock.c:329
#4  0xc05b73cf in vop_stdlock (ap=0x0) at 
/nfs/freebsd/6.x/src/sys/kern/vfs_default.c:258
#5  0xc06f67c4 in VOP_LOCK_APV (vop=0xc0753b20, a=0xd5313a18) at 
vnode_if.c:1642
#6  0xc05d199c in vn_lock (vp=0xc1c96990, flags=4097, td=0xc18abd80) at 
vnode_if.h:844
#7  0xc05c55da in filt_vfsread (kn=0xc1a0ac38, hint=6) at pcpu.h:162
#8  0xc053579f in knote (list=0xc1ca3030, hint=6, islocked=0) at 
/nfs/freebsd/6.x/src/sys/kern/kern_event.c:1527
#9  0xc06f5eca in VOP_WRITE_APV (vop=0x0, a=0xd5313bf8) at 
vnode_if.c:711
#10 0xc05d1180 in vn_write (fp=0xc1980cf0, uio=0xd5313c6c, 
active_cred=0xc1a83b00, flags=0, td=0xc18abd80) at vnode_if.h:372
#11 0xc0580ccb in dofilewrite (td=0xc18abd80, fp=0xc1980cf0, fd=0, 
buf=0x0, nbyte=3228911264, offset=Unhandled dwarf expression opcode 
0x93
) at file.h:246
#12 0xc0580af9 in write (td=0xc18abd80, uap=0xd5313d04) at 
/nfs/freebsd/6.x/src/sys/kern/sys_generic.c:301
#13 0xc06e3960 in syscall (frame=
       {tf_fs = 59, tf_es = 134611003, tf_ds = -1078001605, tf_edi = 0, 
tf_esi = 134661120, tf_ebp = -1077946680, tf_isp = -718193308, tf_ebx = 
6, tf_edx = 134661120, tf_ecx = 6, tf_eax = 4, tf_trapno = 12, tf_err = 
2, tf_eip = 672319503, tf_cs = 51, tf_eflags = 582, tf_esp = 
-1077946708, tf_ss = 59})
     at /nfs/freebsd/6.x/src/sys/i386/i386/trap.c:984
#14 0xc06d33ff in Xint0x80_syscall () at 
/nfs/freebsd/6.x/src/sys/i386/i386/exception.s:200
*snip*
(kgdb) f 3
#3  0xc0548cad in lockmgr (lkp=0xc1c969e8, flags=12290, interlkp=0x80, 
td=0xc18abd80) at /nfs/freebsd/6.x/src/sys/kern/kern_lock.c:329
329                                     panic("lockmgr: locking against 
myself");
(kgdb) p *lkp
$8 = {lk_interlock = 0xc0771b3c, lk_flags = 262272, lk_sharecount = 0, 
lk_waitcount = 0, lk_exclusivecount = 1, lk_prio = 80, lk_wmesg = 
0xc0727299 "nfs",
   lk_timo = 51, lk_lockholder = 0xc18abd80, lk_newlock = 0x0}
(kgdb) f 6
#6  0xc05d199c in vn_lock (vp=0xc1c96990, flags=4097, td=0xc18abd80) at 
vnode_if.h:844
844             a.a_td = td;
(kgdb) p *vp
$14 = {v_type = VREG, v_tag = 0xc0727299 "nfs", v_op = 0xc075ab20, 
v_data = 0xc1c951cc, v_mount = 0xc189d000, v_nmntvnodes = {tqe_next = 
0xc1c96880,
     tqe_prev = 0xc1c96ab4}, v_un = {vu_mount = 0x0, vu_socket = 0x0, 
vu_cdev = 0x0, vu_fifoinfo = 0x0}, v_hashlist = {le_next = 0x0, le_prev 
= 0xc18d4694},
   v_hash = 1963008825, v_cache_src = {lh_first = 0x0}, v_cache_dst = 
{tqh_first = 0xc1c56440, tqh_last = 0xc1c56450}, v_dd = 0x0, v_cstart = 
0, v_lasta = 0,
   v_lastw = 0, v_clen = 0, v_lock = {lk_interlock = 0xc0771b3c, 
lk_flags = 262272, lk_sharecount = 0, lk_waitcount = 0, 
lk_exclusivecount = 1, lk_prio = 80,
     lk_wmesg = 0xc0727299 "nfs", lk_timo = 51, lk_lockholder = 
0xc18abd80, lk_newlock = 0x0}, v_interlock = {mtx_object = {lo_class = 
0xc074cc84,
       lo_name = 0xc0721417 "vnode interlock", lo_type = 0xc0721417 
"vnode interlock", lo_flags = 196608, lo_list = {tqe_next = 0x0, 
tqe_prev = 0x0},
       lo_witness = 0x0}, mtx_lock = 4, mtx_recurse = 0}, v_vnlock = 
0xc1c969e8, v_holdcnt = 4, v_usecount = 2, v_iflag = 0, v_vflag = 0, 
v_writecount = 1,
   v_freelist = {tqe_next = 0xc1ae5220, tqe_prev = 0xc1aedc68}, v_bufobj 
= {bo_mtx = 0xc1c96a0c, bo_clean = {bv_hd = {tqh_first = 0x0, tqh_last 
= 0xc1c96a54},
       bv_root = 0x0, bv_cnt = 0}, bo_dirty = {bv_hd = {tqh_first = 
0xc92ad140, tqh_last = 0xc92ad178}, bv_root = 0xc92ad140, bv_cnt = 1}, 
bo_numoutput = 0,
     bo_flag = 1, bo_ops = 0xc075ae0c, bo_bsize = 8192, bo_object = 
0xc1c897bc, bo_synclist = {le_next = 0xc1ca0c70, le_prev = 0xc18a0298},
     bo_private = 0xc1c96990, __bo_vnode = 0xc1c96990}, v_pollinfo = 
0xc1ca3000, v_label = 0x0}

-- 
  Marcel Moolenaar         USPA: A-39004          marcel_at_xcllnt.net
Received on Fri Jul 01 2005 - 22:26:50 UTC

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