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

next in thread | raw e-mail | index | archive | help
Author: rmacklem
Date: Fri Oct  4 04:57:36 2019
New Revision: 353097
URL: https://svnweb.freebsd.org/changeset/base/353097

Log:
  Flush writes for both in and out files before NFSv4.2 Copy in client.
  
  The input file needs to be up to date on the server and the writes
  need to be flushed on the output file so that they don't overwrite
  copied data on the server.

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 03:55:53 2019	(r353096)
+++ projects/nfsv42/sys/fs/nfsclient/nfs_clvnops.c	Fri Oct  4 04:57:36 2019	(r353097)
@@ -3584,6 +3584,15 @@ nfs_copy_file_range(struct vop_copy_file_range_args *a
 	io.uio_resid = *ap->a_lenp;
 	error = vn_rlimit_fsize(outvp, &io, ap->a_fsizetd);
 
+	/*
+	 * Flush all writes for both files, so they will be up to date
+	 * on the server before doing the copy.
+	 */
+	if (error == 0)
+		error = ncl_flush(invp, MNT_WAIT, curthread, 1, 0);
+	if (error == 0)
+		error = ncl_flush(outvp, MNT_WAIT, curthread, 1, 0);
+
 	/* Do the actual NFSv4.2 RPC. */
 	len = *ap->a_lenp;
 	mtx_lock(&nmp->nm_mtx);



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