svn commit: r187531 - in stable/7/sys: . contrib/pf dev/ath/ath_hal dev/cxgb ufs/ufs

Konstantin Belousov kib at FreeBSD.org
Wed Jan 21 07:06:57 PST 2009


Author: kib
Date: Wed Jan 21 15:06:53 2009
New Revision: 187531
URL: http://svn.freebsd.org/changeset/base/187531

Log:
  MFC r185170. r185556:
  
  Busy ufs filesystem around block of code that does ".." lookup.
  Do not lock vnode interlock around reading of v_iflag to check VI_DOOMED.

Modified:
  stable/7/sys/   (props changed)
  stable/7/sys/contrib/pf/   (props changed)
  stable/7/sys/dev/ath/ath_hal/   (props changed)
  stable/7/sys/dev/cxgb/   (props changed)
  stable/7/sys/ufs/ufs/ufs_lookup.c

Modified: stable/7/sys/ufs/ufs/ufs_lookup.c
==============================================================================
--- stable/7/sys/ufs/ufs/ufs_lookup.c	Wed Jan 21 15:04:06 2009	(r187530)
+++ stable/7/sys/ufs/ufs/ufs_lookup.c	Wed Jan 21 15:06:53 2009	(r187531)
@@ -158,6 +158,7 @@ ufs_lookup(ap)
 	struct thread *td = cnp->cn_thread;
 	ino_t ino;
 	int ltype;
+	struct mount *mp;
 
 	bp = NULL;
 	slotoffset = -1;
@@ -579,9 +580,26 @@ found:
 	pdp = vdp;
 	if (flags & ISDOTDOT) {
 		ltype = VOP_ISLOCKED(pdp, td);
+		mp = pdp->v_mount;
+		for (;;) {
+			error = vfs_busy(mp, LK_NOWAIT, NULL, td);
+			if (error == 0)
+				break;
+			VOP_UNLOCK(pdp, 0, td);
+			pause("ufs_dd", 1);
+			vn_lock(pdp, ltype | LK_RETRY, td);
+			if (pdp->v_iflag & VI_DOOMED)
+				return (ENOENT);
+		}
 		VOP_UNLOCK(pdp, 0, td);	/* race to get the inode */
-		error = VFS_VGET(pdp->v_mount, ino, cnp->cn_lkflags, &tdp);
+		error = VFS_VGET(mp, ino, cnp->cn_lkflags, &tdp);
+		vfs_unbusy(mp, td);
 		vn_lock(pdp, ltype | LK_RETRY, td);
+		if (pdp->v_iflag & VI_DOOMED) {
+			if (error == 0)
+				vput(tdp);
+			error = ENOENT;
+		}
 		if (error)
 			return (error);
 		*vpp = tdp;


More information about the svn-src-stable mailing list