nfs_commonkrpc.c: Improve handling of NFSv4.1/4.2 recovery

Commit 4d80d4913e 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:	4d80d4913e ("nfs: Fix argument typo to avoid a crash")
This commit is contained in:
Rick Macklem
2026-06-04 15:02:48 -07:00
parent 22c1f5d0ec
commit ea4886f282
+8 -5
View File
@@ -1268,17 +1268,20 @@ newnfs_request(struct nfsrv_descript *nd, struct nfsmount *nmp,
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();