From owner-freebsd-fs@FreeBSD.ORG Mon Dec 6 22:07:00 2004 Return-Path: Delivered-To: freebsd-fs@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 0D79916A4CE; Mon, 6 Dec 2004 22:07:00 +0000 (GMT) Received: from mailfe10.swip.net (mailfe10.swip.net [212.247.155.33]) by mx1.FreeBSD.org (Postfix) with ESMTP id 72A1043D48; Mon, 6 Dec 2004 22:06:58 +0000 (GMT) (envelope-from thn@saeab.se) X-T2-Posting-ID: v8Qc5gTTFq+hMtTEBMvVyQ== Received: from [213.100.91.82] (HELO scatcat.thn.saeab.se) by mailfe10.swip.net (CommuniGate Pro SMTP 4.2.6) with ESMTP id 32434528; Mon, 06 Dec 2004 23:06:25 +0100 Received: from saeab.se (home [10.1.0.1])iB6M6ouA020940; Mon, 6 Dec 2004 23:06:50 +0100 (CET) (envelope-from thn@saeab.se) Message-ID: <41B4D832.2D886E86@saeab.se> Date: Mon, 06 Dec 2004 23:07:46 +0100 From: Thomas Nystrom Organization: Sv. Aktuell Elektronik AB X-Mailer: Mozilla 4.78 [en] (Win98; U) X-Accept-Language: sv,en MIME-Version: 1.0 To: Alexander Kabaev References: <41B0C899.C005AE1E@saeab.se> <20041206205628.GA3309@freefall.freebsd.org> Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 8bit cc: freebsd-fs@FreeBSD.org Subject: Re: Dead vnode locking against itself X-BeenThere: freebsd-fs@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Filesystems List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 06 Dec 2004 22:07:00 -0000 Alexander Kabaev wrote: > > On Fri, Dec 03, 2004 at 09:12:09PM +0100, Thomas Nystrom wrote: > > > > 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 > > > I wonder why vclean was called on a vnode with dead_vnodeops in the > first place. I think that is because the vnode is returned to the free list by arla vith a call to vgonel(). That would run vclean() on the vnode and setting it to deadfs. When the vnode then is tried to be recycled vgonel() is called once more on the same vnode. Vgonel() sets the VI_XLOCK on the node, calls vclean(), which calls dead_lock() and finally chkvnlock() which finds VI_XLOCK set and tries to wait for it to be released. Since my first posting I have changed the loop in chkvnlock() to: while ((vp->v_iflag & VI_XLOCK) && (vp->v_vxthread != curthread)) { vp->v_iflag |= VI_XWANT; (void) msleep((caddr_t)vp, VI_MTX(vp), PINOD, "ckvnlk", 0); locked = 1; } That seems to fix the lockup problem. There are still problems in arla but that is another problem. > Could you please post an output of 'print *vp' for > the vnode being cleaned? (kgdb) print *vp $1 = {v_interlock = {mtx_object = {lo_class = 0xc066f25c, lo_name = 0xc06471bc "vnode interlock", lo_type = 0xc06471bc "vnode interlock", lo_flags = 196608, lo_list = { tqe_next = 0xc239d318, tqe_prev = 0xc2399328}, lo_witness = 0x0}, mtx_lock = 3250837056, mtx_recurse = 0}, v_iflag = 129, v_usecount = 0, v_numoutput = 0, v_vxthread = 0xc1c3d640, v_holdcnt = 0, v_cleanblkhd = { tqh_first = 0x0, tqh_last = 0xc239d458}, v_cleanblkroot = 0x0, v_cleanbufcnt = 0, v_dirtyblkhd = {tqh_first = 0x0, tqh_last = 0xc239d468}, v_dirtyblkroot = 0x0, v_dirtybufcnt = 0, v_vflag = 0, v_writecount = 0, v_object = 0x0, v_lastw = 0, v_cstart = 0, v_lasta = 0, v_clen = 0, v_un = { vu_mountedhere = 0x0, vu_socket = 0x0, vu_spec = {vu_cdev = 0x0, vu_specnext = { sle_next = 0x0}}, vu_fifoinfo = 0x0}, v_freelist = {tqe_next = 0x0, tqe_prev = 0xc1e063a0}, v_nmntvnodes = {tqe_next = 0xc241da50, tqe_prev = 0xc21c9cf0}, v_synclist = {le_next = 0x0, le_prev = 0x0}, v_type = VDIR, v_tag = 0xc063729d "none", v_data = 0x0, v_lock = { lk_interlock = 0xc0697808, lk_flags = 16777216, lk_sharecount = 0, lk_waitcount = 0, lk_exclusivecount = 0, lk_prio = 80, lk_wmesg = 0xc1d892b5 "afs", lk_timo = 6, lk_lockholder = 0xffffffff, lk_newlock = 0x0}, v_vnlock = 0xc239d4cc, v_op = 0xc1928800, v_mount = 0x0, v_cache_src = {lh_first = 0x0}, v_cache_dst = {tqh_first = 0x0, tqh_last = 0xc239d500}, v_id = 88207, v_dd = 0xc2488b58, v_ddid = 87557, v_pollinfo = 0x0, v_label = 0x0, v_cachedfs = 4294967295, v_cachedid = 389548441, v_bsize = 512} -- --------------------------------------------------------------- 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@saeab.se ---------------------------------------------------------------