From owner-dev-commits-src-all@freebsd.org Tue Jun 1 01:42:25 2021 Return-Path: Delivered-To: dev-commits-src-all@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 833246369DB; Tue, 1 Jun 2021 01:42:25 +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 4FvFJx3Kd4z3pM4; Tue, 1 Jun 2021 01:42:25 +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 5A71E1AF9C; Tue, 1 Jun 2021 01:42:25 +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 1511gPku051787; Tue, 1 Jun 2021 01:42:25 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1511gPZ6051786; Tue, 1 Jun 2021 01:42:25 GMT (envelope-from git) Date: Tue, 1 Jun 2021 01:42:25 GMT Message-Id: <202106010142.1511gPZ6051786@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: a604806bf73f - stable/12 - nfsd: Reduce the callback timeout to 800msec 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/12 X-Git-Reftype: branch X-Git-Commit: a604806bf73fdac21485bcb14ac6d56cb66b5210 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 01 Jun 2021 01:42:25 -0000 The branch stable/12 has been updated by rmacklem: URL: https://cgit.FreeBSD.org/src/commit/?id=a604806bf73fdac21485bcb14ac6d56cb66b5210 commit a604806bf73fdac21485bcb14ac6d56cb66b5210 Author: Rick Macklem AuthorDate: 2021-05-18 23:17:58 +0000 Commit: Rick Macklem CommitDate: 2021-06-01 01:39:27 +0000 nfsd: Reduce the callback timeout to 800msec Recent discussion on the nfsv4@ietf.org mailing list confirmed that an NFSv4 server should reply to an RPC in less than 1second. If an NFSv4 RPC requires a delegation be recalled, the server will attempt a CB_RECALL callback. If the client is not responsive, the RPC reply will be delayed until the callback times out. Without this patch, the timeout is set to 4 seconds (set in ticks, but used as seconds), resulting in the RPC reply taking over 4sec. This patch redefines the constant as being in milliseconds and it implements that for a value of 800msec, to ensure the RPC reply is sent in less than 1second. This patch only affects mounts from clients when delegations are enabled on the server and the client is unresponsive to callbacks. (cherry picked from commit fc0dc94029df8150301b925bda690b20d9d0bcbf) --- sys/fs/nfs/nfs.h | 2 +- sys/fs/nfs/nfs_commonkrpc.c | 10 ++++++---- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/sys/fs/nfs/nfs.h b/sys/fs/nfs/nfs.h index c6fb59fa6b64..de35f40f40d0 100644 --- a/sys/fs/nfs/nfs.h +++ b/sys/fs/nfs/nfs.h @@ -50,7 +50,7 @@ #define NFS_MAXRCVTIMEO 60 /* 1 minute in seconds */ #define NFS_MINIDEMTIMEO (5 * NFS_HZ) /* Min timeout for non-idempotent ops*/ #define NFS_MAXREXMIT 100 /* Stop counting after this many */ -#define NFSV4_CALLBACKTIMEO (2 * NFS_HZ) /* Timeout in ticks */ +#define NFSV4_CALLBACKTIMEO 800 /* Timeout in msec */ #define NFSV4_CALLBACKRETRY 5 /* Number of retries before failure */ #define NFSV4_SLOTS 64 /* Number of slots, fore channel */ #define NFSV4_CBSLOTS 8 /* Number of slots, back channel */ diff --git a/sys/fs/nfs/nfs_commonkrpc.c b/sys/fs/nfs/nfs_commonkrpc.c index b6fe49b8e470..d583b1c80c3c 100644 --- a/sys/fs/nfs/nfs_commonkrpc.c +++ b/sys/fs/nfs/nfs_commonkrpc.c @@ -762,11 +762,13 @@ tryagain: * use the same xid. */ if (nmp == NULL) { - timo.tv_usec = 0; - if (clp == NULL) + if (clp == NULL) { timo.tv_sec = NFSV4_UPCALLTIMEO; - else - timo.tv_sec = NFSV4_CALLBACKTIMEO; + timo.tv_usec = 0; + } else { + timo.tv_sec = NFSV4_CALLBACKTIMEO / 1000; + timo.tv_usec = NFSV4_CALLBACKTIMEO * 1000; + } } else { if (nrp->nr_sotype != SOCK_DGRAM) { timo.tv_usec = 0;