aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRick Macklem <rmacklem@FreeBSD.org>2021-10-16 22:49:38 +0000
committerRick Macklem <rmacklem@FreeBSD.org>2021-10-16 22:49:38 +0000
commite2aab5e2d73486aa76bb861d583bbce021661601 (patch)
treee22402a6c10f04b1c0772544cc6b59851fe7b1c9
parent79239b5b47540d64ffd1e1226f0d12d49df339c1 (diff)
downloadsrc-e2aab5e2d73486aa76bb861d583bbce021661601.tar.gz
src-e2aab5e2d73486aa76bb861d583bbce021661601.zip
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. MFC after: 2 week
-rw-r--r--sys/fs/nfsclient/nfs_clrpcops.c11
-rw-r--r--sys/fs/nfsclient/nfs_clstate.c1
2 files changed, 6 insertions, 6 deletions
diff --git a/sys/fs/nfsclient/nfs_clrpcops.c b/sys/fs/nfsclient/nfs_clrpcops.c
index 04597a27edfa..08c9117a8fc1 100644
--- a/sys/fs/nfsclient/nfs_clrpcops.c
+++ b/sys/fs/nfsclient/nfs_clrpcops.c
@@ -749,13 +749,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 d3ce1c6bef8b..7ad0f1c1a364 100644
--- a/sys/fs/nfsclient/nfs_clstate.c
+++ b/sys/fs/nfsclient/nfs_clstate.c
@@ -3381,6 +3381,7 @@ lookformore:
goto lookformore;
}
}
+ nfscl_clrelease(clp);
NFSUNLOCKCLSTATE();
/*
* recallp has been set NULL by nfscl_retoncloselayout() if it was