Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 30 Oct 2021 03:45:30 GMT
From:      Rick Macklem <rmacklem@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org
Subject:   git: 627b15e81406 - stable/13 - nfscl: Move release of the clientID lock into nfscl_doclose()
Message-ID:  <202110300345.19U3jUW5011615@gitrepo.freebsd.org>

next in thread | raw e-mail | index | archive | help
The branch stable/13 has been updated by rmacklem:

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

commit 627b15e8140675f136e9f4e72a2204cac0316eeb
Author:     Rick Macklem <rmacklem@FreeBSD.org>
AuthorDate: 2021-10-16 22:49:38 +0000
Commit:     Rick Macklem <rmacklem@FreeBSD.org>
CommitDate: 2021-10-30 03:42:08 +0000

    nfscl: Move release of the clientID lock into nfscl_doclose()
    
    This patch moves release of the shared clientID lock from nfsrpc_close()
    just after the nfscl_doclose() call to the end of nfscl_doclose() call.
    This does make the code cleaner, since the shared lock is acquired at
    the beginning of nfscl_doclose().  The only semantics change is that
    the code no longer drops and reaquires the NFSCLSTATELOCK() mutex,
    which I do not believe will have a negative effect on the NFSv4 client.
    
    This is being done to prepare the code for a future patch that fixes
    the case where an NFSv4.1/4.2 server replies NFSERR_DELAY to a Close
    operation.
    
    (cherry picked from commit e2aab5e2d73486aa76bb861d583bbce021661601)
---
 sys/fs/nfsclient/nfs_clrpcops.c | 11 +++++------
 sys/fs/nfsclient/nfs_clstate.c  |  1 +
 2 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/sys/fs/nfsclient/nfs_clrpcops.c b/sys/fs/nfsclient/nfs_clrpcops.c
index 795eafabb6de..fc7d8687be77 100644
--- a/sys/fs/nfsclient/nfs_clrpcops.c
+++ b/sys/fs/nfsclient/nfs_clrpcops.c
@@ -747,13 +747,12 @@ nfsrpc_close(vnode_t vp, int doclose, NFSPROC_T *p)
 		return (0);
 	if (doclose)
 		error = nfscl_doclose(vp, &clp, p);
-	else
+	else {
 		error = nfscl_getclose(vp, &clp);
-	if (error)
-		return (error);
-
-	nfscl_clientrelease(clp);
-	return (0);
+		if (error == 0)
+			nfscl_clientrelease(clp);
+	}
+	return (error);
 }
 
 /*
diff --git a/sys/fs/nfsclient/nfs_clstate.c b/sys/fs/nfsclient/nfs_clstate.c
index 4c74963da747..984d8382ee45 100644
--- a/sys/fs/nfsclient/nfs_clstate.c
+++ b/sys/fs/nfsclient/nfs_clstate.c
@@ -3383,6 +3383,7 @@ lookformore:
 			goto lookformore;
 		}
 	}
+	nfscl_clrelease(clp);
 	NFSUNLOCKCLSTATE();
 	/*
 	 * recallp has been set NULL by nfscl_retoncloselayout() if it was



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202110300345.19U3jUW5011615>