Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 04 Jun 2026 22:04:21 +0000
From:      Rick Macklem <rmacklem@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org
Subject:   git: ea4886f2829b - main - nfs_commonkrpc.c: Improve handling of NFSv4.1/4.2 recovery
Message-ID:  <6a21f665.4260e.2d7ed2b6@gitrepo.freebsd.org>

index | next in thread | raw e-mail

The branch main has been updated by rmacklem:

URL: https://cgit.FreeBSD.org/src/commit/?id=ea4886f2829bf33866c8c0c60b14a9641fc54b40

commit ea4886f2829bf33866c8c0c60b14a9641fc54b40
Author:     Rick Macklem <rmacklem@FreeBSD.org>
AuthorDate: 2026-06-04 22:02:48 +0000
Commit:     Rick Macklem <rmacklem@FreeBSD.org>
CommitDate: 2026-06-04 22:02:48 +0000

    nfs_commonkrpc.c: Improve handling of NFSv4.1/4.2 recovery
    
    Commit 4d80d4913e79 fixed a long standing bug in the recovery
    code.  However. glebius@ reported seeing multiple
    recovery cycles with this patch during an NFSv4.1/4.2
    server reboot.
    
    This commit should minimize the risk of multiple
    recovery cycles.
    
    PR:     294925
    Reported by:    Jov <amutu@amutu.com>
    MFC after:      2 weeks
    Fixes:  4d80d4913e79 ("nfs: Fix argument typo to avoid a crash")
---
 sys/fs/nfs/nfs_commonkrpc.c | 13 ++++++++-----
 1 file changed, 8 insertions(+), 5 deletions(-)

diff --git a/sys/fs/nfs/nfs_commonkrpc.c b/sys/fs/nfs/nfs_commonkrpc.c
index 2d4c41994c0e..f30ae7cbffa2 100644
--- a/sys/fs/nfs/nfs_commonkrpc.c
+++ b/sys/fs/nfs/nfs_commonkrpc.c
@@ -1268,17 +1268,20 @@ tryagain:
 				if (bcmp(sep->nfsess_sessionid,
 				    nd->nd_sessionid, NFSX_V4SESSIONID) == 0 &&
 				    sep->nfsess_defunct == 0) {
-					printf("Initiate recovery. If server "
-					    "has not rebooted, "
-					    "check NFS clients for unique "
-					    "/etc/hostid's\n");
 					/* Initiate recovery. */
 					sep->nfsess_defunct = 1;
 					NFSCL_DEBUG(1, "Marked defunct\n");
-					if (nmp->nm_clp != NULL) {
+					if (nmp->nm_clp != NULL &&
+					    (nmp->nm_clp->nfsc_flags &
+					     (NFSCLFLAGS_RECVRINPROG |
+					      NFSCLFLAGS_RECOVER)) == 0) {
 						nmp->nm_clp->nfsc_flags |=
 						    NFSCLFLAGS_RECOVER;
 						wakeup(nmp->nm_clp);
+						printf("Initiate recovery. If "
+						    "server has not rebooted, "
+						    "check NFS clients for "
+						    "unique /etc/hostid's\n");
 					}
 				}
 				NFSUNLOCKCLSTATE();


home | help

Want to link to this message? Use this
URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?6a21f665.4260e.2d7ed2b6>