From owner-dev-commits-src-main@freebsd.org Wed Sep 8 21:32:48 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id B9971662048; Wed, 8 Sep 2021 21:32:48 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4H4b2m4qljz4sfc; Wed, 8 Sep 2021 21:32:48 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 8680C505B; Wed, 8 Sep 2021 21:32:48 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 188LWmia075183; Wed, 8 Sep 2021 21:32:48 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 188LWm28075182; Wed, 8 Sep 2021 21:32:48 GMT (envelope-from git) Date: Wed, 8 Sep 2021 21:32:48 GMT Message-Id: <202109082132.188LWm28075182@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Rick Macklem Subject: git: 103b207536f9 - main - nfsd: Use the COPY_FILE_RANGE_TIMEO1SEC flag MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: rmacklem X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 103b207536f976cb350558769f5f428e05ec61dc Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 08 Sep 2021 21:32:48 -0000 The branch main has been updated by rmacklem: URL: https://cgit.FreeBSD.org/src/commit/?id=103b207536f976cb350558769f5f428e05ec61dc commit 103b207536f976cb350558769f5f428e05ec61dc Author: Rick Macklem AuthorDate: 2021-09-08 21:29:20 +0000 Commit: Rick Macklem 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)