git: a7bb120f8b87 - main - nfscl: Add a diagnostic printf() for a "should never happen" case

From: Rick Macklem <rmacklem_at_FreeBSD.org>
Date: Fri, 27 May 2022 21:33:46 UTC
The branch main has been updated by rmacklem:

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

commit a7bb120f8b8735bc4c417b3c8fc2308c3d2964aa
Author:     Rick Macklem <rmacklem@FreeBSD.org>
AuthorDate: 2022-05-27 21:32:46 +0000
Commit:     Rick Macklem <rmacklem@FreeBSD.org>
CommitDate: 2022-05-27 21:32:46 +0000

    nfscl: Add a diagnostic printf() for a "should never happen" case
    
    When a NFSv4.1/4.2 session to the NFS server (not a pNFS DS) is
    replaced, the old session should always be marked defunct by
    nfsess_defunct being set non-zero.
    
    However, the hang reported by the PR suggests that this might
    be the case.
    
    This patch adds a printf() to indicate this has somehow happened.
    
    PR:     260011
    MFC after:      2 weeks
---
 sys/fs/nfsclient/nfs_clrpcops.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/sys/fs/nfsclient/nfs_clrpcops.c b/sys/fs/nfsclient/nfs_clrpcops.c
index b1d3ee423194..b785446b1ae6 100644
--- a/sys/fs/nfsclient/nfs_clrpcops.c
+++ b/sys/fs/nfsclient/nfs_clrpcops.c
@@ -1062,8 +1062,12 @@ nfsrpc_setclient(struct nfsmount *nmp, struct nfsclclient *clp, int reclaim,
 			 * in-progress RPCs.
 			 */
 			tsep = NULL;
-			if (TAILQ_FIRST(&nmp->nm_sess) != NULL)
+			if (TAILQ_FIRST(&nmp->nm_sess) != NULL) {
 				tsep = NFSMNT_MDSSESSION(nmp);
+				if (tsep->nfsess_defunct == 0)
+					printf("nfsrpc_setclient: "
+					    "nfsess_defunct not set\n");
+			}
 			TAILQ_INSERT_HEAD(&nmp->nm_sess, dsp,
 			    nfsclds_list);
 			/*