From 1b29b37e26af38bd1aeef1d808338060588d0066 Mon Sep 17 00:00:00 2001 From: jeff Date: Mon, 11 Apr 2005 09:23:56 +0000 Subject: - Assert that we're no longer doing recursive vn_locks in inactive/reclaim as I'd like to get rid of the vxthread. - Handle lock requests which don't actually want a lock as this is a much more convenient place to handle this condition than in vget(). These requests simply want to know that VI_DOOMED isn't set. - Correct a test at the end of vn_lock, if error !=0 should be if error == 0, this has been broken since I comitted the VI_DOOMED changes, but no one ran into it because vget() duplicated this functionality. Sponsored by: Isilon Systems, Inc. --- sys/kern/vfs_vnops.c | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) (limited to 'sys/kern') diff --git a/sys/kern/vfs_vnops.c b/sys/kern/vfs_vnops.c index 8f90614..b51880c 100644 --- a/sys/kern/vfs_vnops.c +++ b/sys/kern/vfs_vnops.c @@ -796,14 +796,23 @@ debug_vn_lock(vp, flags, td, filename, line) { int error; + KASSERT(vp->v_vxthread != curthread, + ("recursive vn_lock in inactive/reclaim.")); do { if ((flags & LK_INTERLOCK) == 0) VI_LOCK(vp); - if ((vp->v_iflag & VI_DOOMED) && vp->v_vxthread != td && - (flags & LK_NOWAIT)) { + if ((flags & LK_NOWAIT || (flags & LK_TYPE_MASK) == 0) && + vp->v_iflag & VI_DOOMED && vp->v_vxthread != td) { VI_UNLOCK(vp); return (ENOENT); } + /* + * Just polling to check validity. + */ + if ((flags & LK_TYPE_MASK) == 0) { + VI_UNLOCK(vp); + return (0); + } #ifdef DEBUG_LOCKS vp->filename = filename; vp->line = line; @@ -818,7 +827,7 @@ debug_vn_lock(vp, flags, td, filename, line) * Callers specify LK_RETRY if they wish to get dead vnodes. * If RETRY is not set, we return ENOENT instead. */ - if (error != 0 && (vp->v_iflag & VI_DOOMED) && + if (error == 0 && vp->v_iflag & VI_DOOMED && vp->v_vxthread != td && (flags & LK_RETRY) == 0) { VOP_UNLOCK(vp, 0, td); error = ENOENT; -- cgit v1.1