git: d9f9a73a3363 - main - krpc/clnt_vc: in clnt_vc_destroy() use more lapidary logic

From: Gleb Smirnoff <glebius_at_FreeBSD.org>
Date: Fri, 17 Jan 2025 07:28:22 UTC
The branch main has been updated by glebius:

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

commit d9f9a73a3363737aef4bae8ef6d71a2159005436
Author:     Gleb Smirnoff <glebius@FreeBSD.org>
AuthorDate: 2025-01-17 03:59:30 +0000
Commit:     Gleb Smirnoff <glebius@FreeBSD.org>
CommitDate: 2025-01-17 07:27:21 +0000

    krpc/clnt_vc: in clnt_vc_destroy() use more lapidary logic
    
    on whether to close the socket or leave it.
---
 sys/rpc/clnt_vc.c | 11 +++--------
 1 file changed, 3 insertions(+), 8 deletions(-)

diff --git a/sys/rpc/clnt_vc.c b/sys/rpc/clnt_vc.c
index 2f2674e694af..e201072b2ee7 100644
--- a/sys/rpc/clnt_vc.c
+++ b/sys/rpc/clnt_vc.c
@@ -849,7 +849,7 @@ static void
 clnt_vc_destroy(CLIENT *cl)
 {
 	struct ct_data *ct = (struct ct_data *) cl->cl_private;
-	struct socket *so = NULL;
+	struct socket *so;
 	SVCXPRT *xprt;
 	uint32_t reterr;
 
@@ -867,19 +867,14 @@ clnt_vc_destroy(CLIENT *cl)
 		SVC_RELEASE(xprt);
 	}
 
-	if (ct->ct_socket) {
-		if (ct->ct_closeit) {
-			so = ct->ct_socket;
-		}
-	}
-
 	/* Wait for the upcall kthread to terminate. */
 	while ((ct->ct_rcvstate & RPCRCVSTATE_UPCALLTHREAD) != 0)
 		msleep(&ct->ct_sslrefno, &ct->ct_lock, 0,
 		    "clntvccl", hz);
 	mtx_unlock(&ct->ct_lock);
-
 	mtx_destroy(&ct->ct_lock);
+
+	so = ct->ct_closeit ? ct->ct_socket : NULL;
 	if (so) {
 		if (ct->ct_sslrefno != 0) {
 			/*