Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 4 Oct 2019 02:04:32 +0000 (UTC)
From:      Rick Macklem <rmacklem@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-projects@freebsd.org
Subject:   svn commit: r353090 - projects/nfsv42/sys/fs/nfsclient
Message-ID:  <201910040204.x9424Wvd064835@repo.freebsd.org>

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



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