Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 17 Jan 2011 01:49:47 +0000 (UTC)
From:      Rick Macklem <rmacklem@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org
Subject:   svn commit: r217497 - stable/8/sys/fs/nfsserver
Message-ID:  <201101170149.p0H1nlV0084282@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: rmacklem
Date: Mon Jan 17 01:49:47 2011
New Revision: 217497
URL: http://svn.freebsd.org/changeset/base/217497

Log:
  MFC: r217023
  Modify the experimental NFS server so that it calls
  vn_start_write() with a non-NULL vp. That way it will
  find the correct mount point mp and use that mp for the
  subsequent vn_finished_write() call. Also, it should fail
  without crashing if the mount point is being forced dismounted
  because vn_start_write() will set the mp NULL via VOP_GETWRITEMOUNT().

Modified:
  stable/8/sys/fs/nfsserver/nfs_nfsdsocket.c
Directory Properties:
  stable/8/sys/   (props changed)
  stable/8/sys/amd64/include/xen/   (props changed)
  stable/8/sys/cddl/contrib/opensolaris/   (props changed)
  stable/8/sys/contrib/dev/acpica/   (props changed)
  stable/8/sys/contrib/pf/   (props changed)

Modified: stable/8/sys/fs/nfsserver/nfs_nfsdsocket.c
==============================================================================
--- stable/8/sys/fs/nfsserver/nfs_nfsdsocket.c	Mon Jan 17 01:37:39 2011	(r217496)
+++ stable/8/sys/fs/nfsserver/nfs_nfsdsocket.c	Mon Jan 17 01:49:47 2011	(r217497)
@@ -498,7 +498,7 @@ nfsrvd_compound(struct nfsrv_descript *n
 	u_char tag[NFSV4_SMALLSTR + 1], *tagstr;
 	vnode_t vp, nvp, savevp;
 	struct nfsrvfh fh;
-	mount_t mp, savemp;
+	mount_t mp, savemp, temp_mp = NULL;
 	struct ucred *credanon;
 	struct nfsexstuff nes, vpnes, savevpnes;
 	static u_int64_t compref = 0;
@@ -837,7 +837,7 @@ nfsrvd_compound(struct nfsrv_descript *n
 			}
 			VREF(vp);
 			if (nfsv4_opflag[op].modifyfs)
-				NFS_STARTWRITE(NULL, &mp);
+				vn_start_write(vp, &temp_mp, V_WAIT);
 			error = (*(nfsrv4_ops1[op]))(nd, isdgram, vp,
 			    &nvp, (fhandle_t *)fh.nfsrvfh_data, p, &vpnes);
 			if (!error && !nd->nd_repstat) {
@@ -871,7 +871,7 @@ nfsrvd_compound(struct nfsrv_descript *n
 				    vrele(nvp);
 			}
 			if (nfsv4_opflag[op].modifyfs)
-				NFS_ENDWRITE(mp);
+				vn_finished_write(temp_mp);
 		    } else if (nfsv4_opflag[op].retfh == 2) {
 			if (vp == NULL || savevp == NULL) {
 				nd->nd_repstat = NFSERR_NOFILEHANDLE;
@@ -881,7 +881,7 @@ nfsrvd_compound(struct nfsrv_descript *n
 				break;
 			}
 			if (nfsv4_opflag[op].modifyfs)
-				NFS_STARTWRITE(NULL, &mp);
+				vn_start_write(savevp, &temp_mp, V_WAIT);
 			if (vn_lock(savevp, LK_EXCLUSIVE) == 0) {
 				VREF(vp);
 				VREF(savevp);
@@ -890,14 +890,15 @@ nfsrvd_compound(struct nfsrv_descript *n
 			} else
 				nd->nd_repstat = NFSERR_PERM;
 			if (nfsv4_opflag[op].modifyfs)
-				NFS_ENDWRITE(mp);
+				vn_finished_write(temp_mp);
 		    } else {
 			if (nfsv4_opflag[op].retfh != 0)
 				panic("nfsrvd_compound");
 			if (nfsv4_opflag[op].needscfh) {
 				if (vp != NULL) {
 					if (nfsv4_opflag[op].modifyfs)
-						NFS_STARTWRITE(NULL, &mp);
+						vn_start_write(vp, &temp_mp,
+						    V_WAIT);
 					if (vn_lock(vp, nfsv4_opflag[op].lktype)
 					    == 0)
 						VREF(vp);
@@ -921,7 +922,7 @@ nfsrvd_compound(struct nfsrv_descript *n
 					error = (*(nfsrv4_ops0[op]))(nd,
 					    isdgram, vp, p, &vpnes);
 				if (nfsv4_opflag[op].modifyfs)
-					NFS_ENDWRITE(mp);
+					vn_finished_write(temp_mp);
 			} else {
 				error = (*(nfsrv4_ops0[op]))(nd, isdgram,
 				    NULL, p, &vpnes);



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