git: aff57157db04 - stable/13 - nfscl: Fix forced dismount when "nconnect" is specified

From: Rick Macklem <rmacklem_at_FreeBSD.org>
Date: Wed, 17 Nov 2021 01:30:06 UTC
The branch stable/13 has been updated by rmacklem:

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

commit aff57157db04d67b2c8d2516021a17575a8c7041
Author:     Rick Macklem <rmacklem@FreeBSD.org>
AuthorDate: 2021-11-03 20:26:38 +0000
Commit:     Rick Macklem <rmacklem@FreeBSD.org>
CommitDate: 2021-11-17 01:27:06 +0000

    nfscl: Fix forced dismount when "nconnect" is specified
    
    When a forced dismount is done and the "nconnect" mount
    option was used, the additional connections must be closed.
    This patch does that.
    
    Found during a recent IETF NFSv4 working group testing event.
    
    (cherry picked from commit ae49051c033a2468af2f1f0079ecaf069b993245)
---
 sys/fs/nfs/nfs_commonkrpc.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/sys/fs/nfs/nfs_commonkrpc.c b/sys/fs/nfs/nfs_commonkrpc.c
index 2235f1077a03..358d77fe5b30 100644
--- a/sys/fs/nfs/nfs_commonkrpc.c
+++ b/sys/fs/nfs/nfs_commonkrpc.c
@@ -1298,9 +1298,13 @@ newnfs_nmcancelreqs(struct nfsmount *nmp)
 {
 	struct nfsclds *dsp;
 	struct __rpc_client *cl;
+	int i;
 
 	if (nmp->nm_sockreq.nr_client != NULL)
 		CLNT_CLOSE(nmp->nm_sockreq.nr_client);
+	for (i = 0; i < nmp->nm_aconnect; i++)
+		if (nmp->nm_aconn[i] != NULL)
+			CLNT_CLOSE(nmp->nm_aconn[i]);
 lookformore:
 	NFSLOCKMNT(nmp);
 	TAILQ_FOREACH(dsp, &nmp->nm_sess, nfsclds_list) {