Skip to content

Commit 6f8b26c

Browse files
Olga KornievskaiaTrond Myklebust
authored andcommitted
SUNRPC: new helper function for stopping backchannel server
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>
1 parent 441244d commit 6f8b26c

2 files changed

Lines changed: 22 additions & 0 deletions

File tree

include/linux/sunrpc/bc_xprt.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ int xprt_setup_bc(struct rpc_xprt *xprt, unsigned int min_reqs);
3232
void xprt_destroy_bc(struct rpc_xprt *xprt, unsigned int max_reqs);
3333
void xprt_free_bc_rqst(struct rpc_rqst *req);
3434
unsigned int xprt_bc_max_slots(struct rpc_xprt *xprt);
35+
void xprt_svc_destroy_nullify_bc(struct rpc_xprt *xprt, struct svc_serv **serv);
3536

3637
/*
3738
* Determine if a shared backchannel is in use
@@ -69,5 +70,10 @@ static inline void set_bc_enabled(struct svc_serv *serv)
6970
static inline void xprt_free_bc_request(struct rpc_rqst *req)
7071
{
7172
}
73+
74+
static inline void xprt_svc_destroy_nullify_bc(struct rpc_xprt *xprt, struct svc_serv **serv)
75+
{
76+
svc_destroy(serv);
77+
}
7278
#endif /* CONFIG_SUNRPC_BACKCHANNEL */
7379
#endif /* _LINUX_SUNRPC_BC_XPRT_H */

net/sunrpc/backchannel_rqst.c

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,22 @@ unsigned int xprt_bc_max_slots(struct rpc_xprt *xprt)
2424
return BC_MAX_SLOTS;
2525
}
2626

27+
/*
28+
* Helper function to nullify backchannel server pointer in transport.
29+
* We need to synchronize setting the pointer to NULL (done so after
30+
* the backchannel server is shutdown) with the usage of that pointer
31+
* by the backchannel request processing routines
32+
* xprt_complete_bc_request() and rpcrdma_bc_receive_call().
33+
*/
34+
void xprt_svc_destroy_nullify_bc(struct rpc_xprt *xprt, struct svc_serv **serv)
35+
{
36+
spin_lock(&xprt->bc_pa_lock);
37+
svc_destroy(serv);
38+
xprt->bc_serv = NULL;
39+
spin_unlock(&xprt->bc_pa_lock);
40+
}
41+
EXPORT_SYMBOL_GPL(xprt_svc_destroy_nullify_bc);
42+
2743
/*
2844
* Helper routines that track the number of preallocation elements
2945
* on the transport.

0 commit comments

Comments
 (0)