]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
SUNRPC: new helper function for stopping backchannel server
authorOlga Kornievskaia <okorniev@redhat.com>
Tue, 4 Nov 2025 22:29:26 +0000 (17:29 -0500)
committerTrond Myklebust <trond.myklebust@hammerspace.com>
Sun, 23 Nov 2025 20:30:12 +0000 (15:30 -0500)
Create a new backchannel function to stop the backchannel server
and clear the bc_serv in transport protected under the bc_pa_lock.

Signed-off-by: Olga Kornievskaia <okorniev@redhat.com>
Signed-off-by: Trond Myklebust <trond.myklebust@hammerspace.com>
include/linux/sunrpc/bc_xprt.h
net/sunrpc/backchannel_rqst.c

index 178f34ad8db6f8c39aae5b62aa614a17a6ba809b..98939cb664cfa8b719e7e675606249e818d9d0e6 100644 (file)
@@ -32,6 +32,7 @@ int xprt_setup_bc(struct rpc_xprt *xprt, unsigned int min_reqs);
 void xprt_destroy_bc(struct rpc_xprt *xprt, unsigned int max_reqs);
 void xprt_free_bc_rqst(struct rpc_rqst *req);
 unsigned int xprt_bc_max_slots(struct rpc_xprt *xprt);
+void xprt_svc_destroy_nullify_bc(struct rpc_xprt *xprt, struct svc_serv **serv);
 
 /*
  * Determine if a shared backchannel is in use
@@ -69,5 +70,10 @@ static inline void set_bc_enabled(struct svc_serv *serv)
 static inline void xprt_free_bc_request(struct rpc_rqst *req)
 {
 }
+
+static inline void xprt_svc_destroy_nullify_bc(struct rpc_xprt *xprt, struct svc_serv **serv)
+{
+       svc_destroy(serv);
+}
 #endif /* CONFIG_SUNRPC_BACKCHANNEL */
 #endif /* _LINUX_SUNRPC_BC_XPRT_H */
index efddea0f4b8b56ed5ea824e6e9e8554e05d12797..68b1fcdea8f00119a22ff86c5c68a9a5724a2e16 100644 (file)
@@ -24,6 +24,22 @@ unsigned int xprt_bc_max_slots(struct rpc_xprt *xprt)
        return BC_MAX_SLOTS;
 }
 
+/*
+ * Helper function to nullify backchannel server pointer in transport.
+ * We need to synchronize setting the pointer to NULL (done so after
+ * the backchannel server is shutdown) with the usage of that pointer
+ * by the backchannel request processing routines
+ * xprt_complete_bc_request() and rpcrdma_bc_receive_call().
+ */
+void xprt_svc_destroy_nullify_bc(struct rpc_xprt *xprt, struct svc_serv **serv)
+{
+       spin_lock(&xprt->bc_pa_lock);
+       svc_destroy(serv);
+       xprt->bc_serv = NULL;
+       spin_unlock(&xprt->bc_pa_lock);
+}
+EXPORT_SYMBOL_GPL(xprt_svc_destroy_nullify_bc);
+
 /*
  * Helper routines that track the number of preallocation elements
  * on the transport.