Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 9 Jun 2009 15:18:01 +0000 (UTC)
From:      Rick Macklem <rmacklem@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r193837 - head/sys/fs/nfsclient
Message-ID:  <200906091518.n59FI1Np075699@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: rmacklem
Date: Tue Jun  9 15:18:01 2009
New Revision: 193837
URL: http://svn.freebsd.org/changeset/base/193837

Log:
  Since vn_lock() with the LK_RETRY flag never returns an error
  for FreeBSD-CURRENT, the code that checked for and returned the
  error was broken. Change it to check for VI_DOOMED set after
  vn_lock() and return an error for that case. I believe this
  should only happen for forced dismounts.
  
  Approved by:	kib (mentor)

Modified:
  head/sys/fs/nfsclient/nfs_clvnops.c

Modified: head/sys/fs/nfsclient/nfs_clvnops.c
==============================================================================
--- head/sys/fs/nfsclient/nfs_clvnops.c	Tue Jun  9 15:10:00 2009	(r193836)
+++ head/sys/fs/nfsclient/nfs_clvnops.c	Tue Jun  9 15:18:01 2009	(r193837)
@@ -2726,14 +2726,16 @@ nfs_advlock(struct vop_advlock_args *ap)
 	struct proc *p = (struct proc *)ap->a_id;
 	struct thread *td = curthread;	/* XXX */
 	struct vattr va;
-	int ret, error = EOPNOTSUPP, vlret;
+	int ret, error = EOPNOTSUPP;
 	u_quad_t size;
 	
 	if (NFS_ISV4(vp) && (ap->a_flags & F_POSIX)) {
 		cred = p->p_ucred;
-		vlret = vn_lock(vp, LK_EXCLUSIVE | LK_RETRY);
-		if (vlret)
-			return (vlret);
+		vn_lock(vp, LK_EXCLUSIVE | LK_RETRY);
+		if (vp->v_iflag & VI_DOOMED) {
+			VOP_UNLOCK(vp, 0);
+			return (EBADF);
+		}
 
 		/*
 		 * If this is unlocking a write locked region, flush and
@@ -2757,9 +2759,11 @@ nfs_advlock(struct vop_advlock_args *ap)
 				error = nfs_catnap(PZERO | PCATCH, "ncladvl");
 				if (error)
 					return (EINTR);
-				vlret = vn_lock(vp, LK_EXCLUSIVE | LK_RETRY);
-				if (vlret)
-					return (vlret);
+				vn_lock(vp, LK_EXCLUSIVE | LK_RETRY);
+				if (vp->v_iflag & VI_DOOMED) {
+					VOP_UNLOCK(vp, 0);
+					return (EBADF);
+				}
 			}
 		} while (ret == NFSERR_DENIED && (ap->a_flags & F_WAIT) &&
 		     ap->a_op == F_SETLK);



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