Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 5 Jan 2011 18:46:05 +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: r217017 - head/sys/fs/nfsserver
Message-ID:  <201101051846.p05Ik5a1087568@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: rmacklem
Date: Wed Jan  5 18:46:05 2011
New Revision: 217017
URL: http://svn.freebsd.org/changeset/base/217017

Log:
  Fix the experimental NFS server to use vfs_busyfs() instead
  of vfs_getvfs() so that the mount point is busied for the
  VFS_FHTOVP() call. This is analagous to r185432 for the
  regular NFS server.
  
  Reviewed by:	kib
  MFC after:	12 days

Modified:
  head/sys/fs/nfsserver/nfs_nfsdport.c

Modified: head/sys/fs/nfsserver/nfs_nfsdport.c
==============================================================================
--- head/sys/fs/nfsserver/nfs_nfsdport.c	Wed Jan  5 18:27:38 2011	(r217016)
+++ head/sys/fs/nfsserver/nfs_nfsdport.c	Wed Jan  5 18:46:05 2011	(r217017)
@@ -2548,8 +2548,8 @@ nfsd_fhtovp(struct nfsrv_descript *nd, s
 	/*
 	 * Check for the special case of the nfsv4root_fh.
 	 */
-	mp = vfs_getvfs(&fhp->fh_fsid);
-	if (!mp) {
+	mp = vfs_busyfs(&fhp->fh_fsid);
+	if (mp == NULL) {
 		*vpp = NULL;
 		nd->nd_repstat = ESTALE;
 		if (*mpp && exp->nes_vfslocked)
@@ -2575,6 +2575,7 @@ nfsd_fhtovp(struct nfsrv_descript *nd, s
 
 	nd->nd_repstat = nfsvno_fhtovp(mp, fhp, nd->nd_nam, lktype, vpp, exp,
 	    &credanon);
+	vfs_unbusy(mp);
 
 	/*
 	 * For NFSv4 without a pseudo root fs, unexported file handles
@@ -2636,11 +2637,8 @@ nfsd_fhtovp(struct nfsrv_descript *nd, s
 			VFS_UNLOCK_GIANT(mp);
 			exp->nes_vfslocked = 0;
 		}
-		vfs_rel(mp);
 		*vpp = NULL;
 		*mpp = NULL;
-	} else {
-		vfs_rel(mp);
 	}
 }
 
@@ -2780,10 +2778,11 @@ nfsvno_getvp(fhandle_t *fhp)
 	struct vnode *vp;
 	int error;
 
-	mp = vfs_getvfs(&fhp->fh_fsid);
+	mp = vfs_busyfs(&fhp->fh_fsid);
 	if (mp == NULL)
 		return (NULL);
 	error = VFS_FHTOVP(mp, &fhp->fh_fid, &vp);
+	vfs_unbusy(mp);
 	if (error)
 		return (NULL);
 	return (vp);



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