svn commit: r353090 - projects/nfsv42/sys/fs/nfsclient

Rick Macklem rmacklem at FreeBSD.org
Fri Oct 4 02:04:33 UTC 2019


Author: rmacklem
Date: Fri Oct  4 02:04:32 2019
New Revision: 353090
URL: https://svnweb.freebsd.org/changeset/base/353090

Log:
  Flush writes in the NFSv4.2 client before doing a Seek operation.
  
  For a Seek operation to work correctly on a NFSv4.2 server, the file must
  be up to date on the server. So, flush writes to the server before doing
  the Seek operation.

Modified:
  projects/nfsv42/sys/fs/nfsclient/nfs_clvnops.c

Modified: projects/nfsv42/sys/fs/nfsclient/nfs_clvnops.c
==============================================================================
--- projects/nfsv42/sys/fs/nfsclient/nfs_clvnops.c	Fri Oct  4 02:04:18 2019	(r353089)
+++ projects/nfsv42/sys/fs/nfsclient/nfs_clvnops.c	Fri Oct  4 02:04:32 2019	(r353090)
@@ -3700,7 +3700,7 @@ nfs_ioctl(struct vop_ioctl_args *ap)
 	struct nfsvattr nfsva;
 	struct nfsmount *nmp;
 	int attrflag, content, error, ret;
-	bool eof;
+	bool eof = false;			/* shut up compiler. */
 
 	if (vp->v_type != VREG)
 		return (ENOTTY);
@@ -3729,8 +3729,11 @@ nfs_ioctl(struct vop_ioctl_args *ap)
 	if (*((off_t *)ap->a_data) >= VTONFS(vp)->n_size)
 		error = ENXIO;
 	else {
-		error = nfsrpc_seek(vp, (off_t *)ap->a_data, &eof, content,
-		    ap->a_cred, &nfsva, &attrflag);
+		/* Flush all writes, so that the server is up to date. */
+		error = ncl_flush(vp, MNT_WAIT, ap->a_td, 1, 0);
+		if (error == 0)
+			error = nfsrpc_seek(vp, (off_t *)ap->a_data, &eof,
+			    content, ap->a_cred, &nfsva, &attrflag);
 		/* If at eof for FIOSEEKDATA, return ENXIO. */
 		if (eof && error == 0 && content == NFSV4CONTENT_DATA)
 			error = ENXIO;


More information about the svn-src-projects mailing list