Dead vnode locking against itself

Thomas Nystrom thn at saeab.se
Fri Dec 3 12:11:22 PST 2004


I'm trying to get ARLA to work stable on FreeBSD (5.3-RELEASE) but have
found that it sometimes hangs: A process gets stuck in 'ckvnlk' state.

I have found someting strange (probably a bug) but I need a second
opinion.

I patched fs/deadfs/dead_vnops so it does a panic when it tries to go
into ckvnlk state and found that it seems to lock against itself.

Part of the backtrace:

#10 0xc04c6f8f in panic (fmt=0x296 <Address 0x296 out of bounds>)
     at /usr/src/sys/kern/kern_shutdown.c:537
#11 0xc0483de3 in chkvnlock (vp=0xc239d420) at /usr/src/sys/fs/deadfs/dead_vnops.c:248
#12 0xc0483d0a in dead_lock (ap=0xdb344914) at /usr/src/sys/fs/deadfs/dead_vnops.c:210
#13 0xc0515f8f in vclean (vp=0xc239d420, flags=8, td=0xc1c3d640) at vnode_if.h:1013
#14 0xc0516525 in vgonel (vp=0xc239d420, td=0xc1c3d640)
     at /usr/src/sys/kern/vfs_subr.c:2701
#15 0xc0513051 in vtryrecycle (vp=0xc239d420) at /usr/src/sys/kern/vfs_subr.c:720
#16 0xc051327a in getnewvnode (tag=0xc0645372 "ufs", mp=0xc1918000, vops=0x0, vpp=0x0)
     at /usr/src/sys/kern/vfs_subr.c:783
---Type <return> to continue, or q <return> to quit---
#17 0xc05bac67 in ffs_vget (mp=0xc1918000, ino=427054, flags=2, vpp=0xdb344a84)
     at /usr/src/sys/ufs/ffs/ffs_vfsops.c:1230
#18 0xc05c1c64 in ufs_lookup (ap=0xdb344b40) at /usr/src/sys/ufs/ufs/ufs_lookup.c:599
#19 0xc05c7eaf in ufs_vnoperate (ap=0x0) at /usr/src/sys/ufs/ufs/ufs_vnops.c:2816
#20 0xc050b5d6 in vfs_cache_lookup (ap=0x0) at vnode_if.h:82
#21 0xc05c7eaf in ufs_vnoperate (ap=0x0) at /usr/src/sys/ufs/ufs/ufs_vnops.c:2816
#22 0xc050fcf3 in lookup (ndp=0xdb344c30) at vnode_if.h:52
#23 0xc050f778 in namei (ndp=0xdb344c30) at /usr/src/sys/kern/vfs_lookup.c:181
#24 0xc051a9f6 in lstat (td=0xc1c3d640, uap=0xdb344d14)
     at /usr/src/sys/kern/vfs_syscalls.c:2069
#25 0xc060e093 in syscall (frame=
       {tf_fs = 47, tf_es = 47, tf_ds = 47, tf_edi = 134609408, tf_esi = 134609480, tf_ebp
= -1077941208, tf_isp = -617329292, tf_ebx = 672396780, tf_edx = 134561792, tf_ecx = 0, tf
_eax = 190, tf_trapno = 12, tf_err = 2, tf_eip = 671905847, tf_cs = 31, tf_eflags = 658, t
f_esp = -1077941364, tf_ss = 47}) at /usr/src/sys/i386/i386/trap.c:1001
#26 0xc06015ff in Xint0x80_syscall () at /usr/src/sys/i386/i386/exception.s:201

If I look at the source I can see that in sys/kern/vfs_subr.c:2696
(in vgonel) the vnode is locked by VI_XLOCK. Later on (via vclean)
dead_lock is called and founds that the vnode is locked. It then
waits for it to be unlocked and the results is a hanged process.

What have I missed or have I found a bug?

/thn

--
---------------------------------------------------------------
Svensk Aktuell Elektronik AB                     Thomas Nyström
Box 10                                    Phone: +46 8 35 92 85
S-191 21  Sollentuna                        Fax: +46 8 35 92 86
Sweden                                      Email: thn at saeab.se
---------------------------------------------------------------


More information about the freebsd-fs mailing list