Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 7 May 2009 18:14:21 +0000 (UTC)
From:      Konstantin Belousov <kib@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r191895 - head/sys/kern
Message-ID:  <200905071814.n47IELHo063951@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: kib
Date: Thu May  7 18:14:21 2009
New Revision: 191895
URL: http://svn.freebsd.org/changeset/base/191895

Log:
  Eliminate the loop and the call to pause(9) in vfs_vget_ino(). If
  vfs_busy(MBF_NOWAIT) failed, unlock the vnode and sleep in vfs_busy().
  
  Suggested and reviewed by:	jeff
  Tested by:	pho
  MFC after:	3 weeks

Modified:
  head/sys/kern/vfs_vnops.c

Modified: head/sys/kern/vfs_vnops.c
==============================================================================
--- head/sys/kern/vfs_vnops.c	Thu May  7 18:03:47 2009	(r191894)
+++ head/sys/kern/vfs_vnops.c	Thu May  7 18:14:21 2009	(r191895)
@@ -1292,15 +1292,17 @@ vn_vget_ino(struct vnode *vp, ino_t ino,
 	ltype = VOP_ISLOCKED(vp);
 	KASSERT(ltype == LK_EXCLUSIVE || ltype == LK_SHARED,
 	    ("vn_vget_ino: vp not locked"));
-	for (;;) {
-		error = vfs_busy(mp, MBF_NOWAIT);
-		if (error == 0)
-			break;
+	error = vfs_busy(mp, MBF_NOWAIT);
+	if (error != 0) {
 		VOP_UNLOCK(vp, 0);
-		pause("vn_vget", 1);
+		error = vfs_busy(mp, 0);
 		vn_lock(vp, ltype | LK_RETRY);
-		if (vp->v_iflag & VI_DOOMED)
+		if (error != 0)
+			return (ENOENT);
+		if (vp->v_iflag & VI_DOOMED) {
+			vfs_unbusy(mp);
 			return (ENOENT);
+		}
 	}
 	VOP_UNLOCK(vp, 0);
 	error = VFS_VGET(mp, ino, lkflags, rvp);



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200905071814.n47IELHo063951>