[Devel] [PATCH v5 1/2] sunrpc: bc_svc_flush_queue_net() helper introduced
Stanislav Kinsburskiy
skinsbursky at virtuozzo.com
Wed Nov 8 20:23:35 MSK 2017
From: Stanislav Kinsburskiy <skinsbursky at parallels.com>
This helper can be used to remove backchannel requests from callback queue on
per-net basis.
Signed-off-by: Stanislav Kinsburskiy <skinsbursky at 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 de8cded..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
More information about the Devel
mailing list