git: b2ff4cb1931c - main - krpc/clnt_vc: set vnet(9) context in clnt_vc kthread

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

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

commit b2ff4cb1931c2e1509a5741f6743322699ad1e00
Author:     Gleb Smirnoff <glebius@FreeBSD.org>
AuthorDate: 2025-01-17 07:38:43 +0000
Commit:     Gleb Smirnoff <glebius@FreeBSD.org>
CommitDate: 2025-01-17 07:38:43 +0000

    krpc/clnt_vc: set vnet(9) context in clnt_vc kthread
    
    The per-client kthread to offload TLS stuff was added ab0c29af0512d.  Let
    it run in the vnet(9) that matches associated socket.
---
 sys/rpc/clnt_vc.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/sys/rpc/clnt_vc.c b/sys/rpc/clnt_vc.c
index e201072b2ee7..d26e6c294af6 100644
--- a/sys/rpc/clnt_vc.c
+++ b/sys/rpc/clnt_vc.c
@@ -1265,6 +1265,7 @@ clnt_vc_dotlsupcall(void *data)
 	enum clnt_stat ret;
 	uint32_t reterr;
 
+	CURVNET_SET(ct->ct_socket->so_vnet);
 	mtx_lock(&ct->ct_lock);
 	ct->ct_rcvstate |= RPCRCVSTATE_UPCALLTHREAD;
 	while (!ct->ct_closed) {
@@ -1300,4 +1301,5 @@ clnt_vc_dotlsupcall(void *data)
 	mtx_unlock(&ct->ct_lock);
 	CLNT_RELEASE(cl);
 	kthread_exit();
+	CURVNET_RESTORE();
 }