Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 25 Sep 2021 20:44:15 GMT
From:      Rick Macklem <rmacklem@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org
Subject:   git: f3410f8798fe - stable/13 - nfsd: Use the COPY_FILE_RANGE_TIMEO1SEC flag
Message-ID:  <202109252044.18PKiF9A080640@gitrepo.freebsd.org>

next in thread | raw e-mail | index | archive | help
The branch stable/13 has been updated by rmacklem:

URL: https://cgit.FreeBSD.org/src/commit/?id=f3410f8798fe7c8ccb30a3baa303506d49726270

commit f3410f8798fe7c8ccb30a3baa303506d49726270
Author:     Rick Macklem <rmacklem@FreeBSD.org>
AuthorDate: 2021-09-08 21:29:20 +0000
Commit:     Rick Macklem <rmacklem@FreeBSD.org>
CommitDate: 2021-09-25 20:40:53 +0000

    nfsd: Use the COPY_FILE_RANGE_TIMEO1SEC flag
    
    Although it is not specified in the RFCs, the concept that
    the NFSv4 server should reply to an RPC request within a
    reasonable time is accepted practice within the NFSv4 community.
    
    Without this patch, the NFSv4.2 server attempts to reply to
    a Copy operation within 1 second by limiting the copy to
    vfs.nfs.maxcopyrange bytes (default 10Mbytes). This is crude at
    best, given the large variation in I/O subsystem performance.
    
    This patch uses the COPY_FILE_RANGE_TIMEO1SEC flag added by
    commit c5128c48df3c to limit the reply time for a Copy
    operation to approximately 1 second.
    
    (cherry picked from commit 103b207536f976cb350558769f5f428e05ec61dc)
---
 sys/fs/nfsserver/nfs_nfsdserv.c | 19 +++----------------
 1 file changed, 3 insertions(+), 16 deletions(-)

diff --git a/sys/fs/nfsserver/nfs_nfsdserv.c b/sys/fs/nfsserver/nfs_nfsdserv.c
index 12181d04f1fa..9bfa6dd3a99b 100644
--- a/sys/fs/nfsserver/nfs_nfsdserv.c
+++ b/sys/fs/nfsserver/nfs_nfsdserv.c
@@ -65,7 +65,6 @@ extern int nfsd_debuglevel;
 extern u_long sb_max_adj;
 extern int nfsrv_pnfsatime;
 extern int nfsrv_maxpnfsmirror;
-extern int nfs_maxcopyrange;
 extern uint32_t nfs_srvmaxio;
 
 static int	nfs_async = 0;
@@ -5401,7 +5400,6 @@ nfsrvd_copy_file_range(struct nfsrv_descript *nd, __unused int isdgram,
 	int cnt, error = 0, ret;
 	off_t inoff, outoff;
 	uint64_t len;
-	size_t xfer;
 	struct nfsstate inst, outst, *instp = &inst, *outstp = &outst;
 	struct nfslock inlo, outlo, *inlop = &inlo, *outlop = &outlo;
 	nfsquad_t clientid;
@@ -5576,21 +5574,10 @@ nfsrvd_copy_file_range(struct nfsrv_descript *nd, __unused int isdgram,
 			nd->nd_repstat = error;
 	}
 
-	/*
-	 * Do the actual copy to an upper limit of vfs.nfs.maxcopyrange.
-	 * This limit is applied to ensure that the RPC replies in a
-	 * reasonable time.
-	 */
-	if (len > nfs_maxcopyrange)
-		xfer = nfs_maxcopyrange;
-	else
-		xfer = len;
-	if (nd->nd_repstat == 0) {
+	if (nd->nd_repstat == 0)
 		nd->nd_repstat = vn_copy_file_range(vp, &inoff, tovp, &outoff,
-		    &xfer, 0, nd->nd_cred, nd->nd_cred, NULL);
-		if (nd->nd_repstat == 0)
-			len = xfer;
-	}
+		    &len, COPY_FILE_RANGE_TIMEO1SEC, nd->nd_cred, nd->nd_cred,
+		    NULL);
 
 	/* Unlock the ranges. */
 	if (rl_rcookie != NULL)



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