git: fc0dc94029df - main - nfsd: Reduce the callback timeout to 800msec
Rick Macklem
rmacklem at FreeBSD.org
Tue May 18 23:21:00 UTC 2021
The branch main has been updated by rmacklem:
URL: https://cgit.FreeBSD.org/src/commit/?id=fc0dc94029df8150301b925bda690b20d9d0bcbf
commit fc0dc94029df8150301b925bda690b20d9d0bcbf
Author: Rick Macklem <rmacklem at FreeBSD.org>
AuthorDate: 2021-05-18 23:17:58 +0000
Commit: Rick Macklem <rmacklem at FreeBSD.org>
CommitDate: 2021-05-18 23:17:58 +0000
nfsd: Reduce the callback timeout to 800msec
Recent discussion on the nfsv4 at 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.
MFC after: 2 weeks
---
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 44b6042a2ce7..272b8dbfee22 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 49c68da45a69..04ef04955ce0 100644
--- a/sys/fs/nfs/nfs_commonkrpc.c
+++ b/sys/fs/nfs/nfs_commonkrpc.c
@@ -767,11 +767,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;
More information about the dev-commits-src-main
mailing list