The commit is pushed to "branch-rh7-3.10.0-693.1.1.vz7.37.x-ovz" and will appear at https://src.openvz.org/scm/ovz/vzkernel.git after rh7-3.10.0-693.1.1.vz7.37.27 ------> commit ca2dc121100718f4f175e5613b7511d3758790a1 Author: Stanislav Kinsburskiy <skinsbur...@virtuozzo.com> Date: Mon Nov 13 17:11:18 2017 +0300
sunrpc: bc_svc_flush_queue_net() helper introduced Patchset description: nfs: fix race between callback shutdown and execution The idea is to use mutex for protecting callback execution agains per-net callback shutdown and destroying all the net-related backchannel requests before transports destruction. Stanislav Kinsburskiy (2): sunrpc: bc_svc_flush_queue_net() helper introduced nfs: protect callback execution against per-net callback thread shutdown ====================== This patch description: This helper can be used to remove backchannel requests from callback queue on per-net basis. https://jira.sw.ru/browse/PSBM-75751 Signed-off-by: Stanislav Kinsburskiy <skinsbur...@virtuozzo.com> Reviewed-by: Kirill Tkhai <ktk...@virtuozzo.com> --- include/linux/sunrpc/svc.h | 2 ++ net/sunrpc/svc.c | 15 +++++++++++++++ 2 files changed, 17 insertions(+) diff --git a/include/linux/sunrpc/svc.h b/include/linux/sunrpc/svc.h index 2b30868..fe70ff0 100644 --- a/include/linux/sunrpc/svc.h +++ b/include/linux/sunrpc/svc.h @@ -484,6 +484,8 @@ void svc_reserve(struct svc_rqst *rqstp, int space); struct svc_pool * svc_pool_for_cpu(struct svc_serv *serv, int cpu); char * svc_print_addr(struct svc_rqst *, char *, size_t); +void bc_svc_flush_queue_net(struct svc_serv *serv, struct net *net); + #define RPC_MAX_ADDRBUFLEN (63U) /* diff --git a/net/sunrpc/svc.c b/net/sunrpc/svc.c index de8cded1..2ca4ff7 100644 --- a/net/sunrpc/svc.c +++ b/net/sunrpc/svc.c @@ -1338,6 +1338,21 @@ svc_process(struct svc_rqst *rqstp) EXPORT_SYMBOL_GPL(svc_process); #if defined(CONFIG_SUNRPC_BACKCHANNEL) +void bc_svc_flush_queue_net(struct svc_serv *serv, struct net *net) +{ + struct rpc_rqst *req, *tmp; + + spin_lock_bh(&serv->sv_cb_lock); + list_for_each_entry_safe(req, tmp, &serv->sv_cb_list, rq_bc_list) { + if (req->rq_xprt->xprt_net == net) { + list_del(&req->rq_bc_list); + xprt_free_bc_request(req); + } + } + spin_unlock_bh(&serv->sv_cb_lock); +} +EXPORT_SYMBOL_GPL(bc_svc_flush_queue_net); + /* * Process a backchannel RPC request that arrived over an existing * outbound connection _______________________________________________ Devel mailing list Devel@openvz.org https://lists.openvz.org/mailman/listinfo/devel