From nobody Tue Nov 16 23:56:48 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 457B91857AF3; Tue, 16 Nov 2021 23:56: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 4Hv2z41ZDmz3qNS; Tue, 16 Nov 2021 23:56: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 15CCF16CF8; Tue, 16 Nov 2021 23:56: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 1AGNum6o019258; Tue, 16 Nov 2021 23:56:48 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1AGNumOJ019257; Tue, 16 Nov 2021 23:56:48 GMT (envelope-from git) Date: Tue, 16 Nov 2021 23:56:48 GMT Message-Id: <202111162356.1AGNumOJ019257@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Rick Macklem Subject: git: fa8d8f299ba1 - stable/13 - nfscl: Use a smaller initial delay time for NFSERR_DELAY List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org 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/stable/13 X-Git-Reftype: branch X-Git-Commit: fa8d8f299ba1eb2dcfd763e096e90dbc57066c57 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by rmacklem: URL: https://cgit.FreeBSD.org/src/commit/?id=fa8d8f299ba1eb2dcfd763e096e90dbc57066c57 commit fa8d8f299ba1eb2dcfd763e096e90dbc57066c57 Author: Rick Macklem AuthorDate: 2021-11-02 00:21:31 +0000 Commit: Rick Macklem CommitDate: 2021-11-16 23:52:17 +0000 nfscl: Use a smaller initial delay time for NFSERR_DELAY For NFS RPCs that receive a NFSERR_DELAY reply, the delay time is initially 1sec and then increases exponentially to NFS_TRYLATERDEL. It was found that this delay time is excessive for some NFSv4 servers, which work well with a 1msec delay. A 1sec delay resulted in very slow performance for Remove and Rename when delegations and pNFS were enabled. This patch decreases the initial delay time to 1msec. Found during a recent IETF NFSv4 working group testing event. (cherry picked from commit 5a95a6e8e4d9e947b3bb4b4755a7242e1ddd72e7) --- sys/fs/nfs/nfs_commonkrpc.c | 30 ++++++++++++++++++++++-------- 1 file changed, 22 insertions(+), 8 deletions(-) diff --git a/sys/fs/nfs/nfs_commonkrpc.c b/sys/fs/nfs/nfs_commonkrpc.c index 423ddb52494f..2235f1077a03 100644 --- a/sys/fs/nfs/nfs_commonkrpc.c +++ b/sys/fs/nfs/nfs_commonkrpc.c @@ -107,6 +107,10 @@ static int nfs_reconnects; static int nfs3_jukebox_delay = 10; static int nfs_skip_wcc_data_onerr = 1; static int nfs_dsretries = 2; +static struct timespec nfs_trylater_max = { + .tv_sec = NFS_TRYLATERDEL, + .tv_nsec = 0, +}; SYSCTL_DECL(_vfs_nfs); @@ -584,12 +588,11 @@ newnfs_request(struct nfsrv_descript *nd, struct nfsmount *nmp, u_char *retsum, int toplevel, u_int64_t *xidp, struct nfsclsession *dssep) { uint32_t retseq, retval, slotseq, *tl; - time_t waituntil; int i = 0, j = 0, opcnt, set_sigset = 0, slot; int error = 0, usegssname = 0, secflavour = AUTH_SYS; int freeslot, maxslot, reterr, slotpos, timeo; u_int16_t procnum; - u_int nextconn, trylater_delay = 1; + u_int nextconn; struct nfs_feedback_arg nf; struct timeval timo; AUTH *auth; @@ -602,7 +605,11 @@ newnfs_request(struct nfsrv_descript *nd, struct nfsmount *nmp, struct nfsclsession *sep; uint8_t sessionid[NFSX_V4SESSIONID]; bool nextconn_set; + struct timespec trylater_delay, ts, waituntil; + /* Initially 1msec. */ + trylater_delay.tv_sec = 0; + trylater_delay.tv_nsec = 1000000; sep = dssep; if (xidp != NULL) *xidp = 0; @@ -1144,12 +1151,19 @@ tryagain: (nd->nd_repstat == NFSERR_DELAY && (nd->nd_flag & ND_NFSV4) == 0) || nd->nd_repstat == NFSERR_RESOURCE) { - if (trylater_delay > NFS_TRYLATERDEL) - trylater_delay = NFS_TRYLATERDEL; - waituntil = NFSD_MONOSEC + trylater_delay; - while (NFSD_MONOSEC < waituntil) - (void) nfs_catnap(PZERO, 0, "nfstry"); - trylater_delay *= 2; + /* Clip at NFS_TRYLATERDEL. */ + if (timespeccmp(&trylater_delay, + &nfs_trylater_max, >)) + trylater_delay = nfs_trylater_max; + getnanouptime(&waituntil); + timespecadd(&waituntil, &trylater_delay, + &waituntil); + do { + nfs_catnap(PZERO, 0, "nfstry"); + getnanouptime(&ts); + } while (timespeccmp(&ts, &waituntil, <)); + timespecadd(&trylater_delay, &trylater_delay, + &trylater_delay); /* Double each time. */ if (slot != -1) { mtx_lock(&sep->nfsess_mtx); sep->nfsess_slotseq[slot]++;