git: 103b207536f9 - main - nfsd: Use the COPY_FILE_RANGE_TIMEO1SEC flag
Rick Macklem
rmacklem at FreeBSD.org
Wed Sep 8 21:32:48 UTC 2021
The branch main has been updated by rmacklem:
URL: https://cgit.FreeBSD.org/src/commit/?id=103b207536f976cb350558769f5f428e05ec61dc
commit 103b207536f976cb350558769f5f428e05ec61dc
Author: Rick Macklem <rmacklem at FreeBSD.org>
AuthorDate: 2021-09-08 21:29:20 +0000
Commit: Rick Macklem <rmacklem at FreeBSD.org>
CommitDate: 2021-09-08 21:29:20 +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.
MFC after: 2 weeks
---
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 2d4635c75204..d82057fb9d9e 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;
@@ -5506,7 +5505,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;
@@ -5681,21 +5679,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)
More information about the dev-commits-src-all
mailing list