Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 21 Jan 2009 15:06:53 +0000 (UTC)
From:      Konstantin Belousov <kib@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org
Subject:   svn commit: r187531 - in stable/7/sys: . contrib/pf dev/ath/ath_hal dev/cxgb ufs/ufs
Message-ID:  <200901211506.n0LF6rwP081130@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
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;



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