[Devel] [PATCH RHEL7 COMMIT] sunrpc: pending tasks kill helper added

Konstantin Khorenko khorenko at virtuozzo.com
Tue Jun 27 13:05:55 MSK 2017


The commit is pushed to "branch-rh7-3.10.0-514.16.1.vz7.32.x-ovz" and will appear at https://src.openvz.org/scm/ovz/vzkernel.git
after rh7-3.10.0-514.16.1.vz7.32.11
------>
commit eddce79feb06bcf28a536166049b6df275c573ac
Author: Stanislav Kinsburskiy <skinsbursky at virtuozzo.com>
Date:   Tue Jun 27 14:05:55 2017 +0400

    sunrpc: pending tasks kill helper added
    
    This patch aborts SUNRPC tasks upon raise of per-net "kill_tasks" toggle.
    This is needed to abort pernding tasks, which are waiting for timeout.
    
    https://jira.sw.ru/browse/PSBM-66510
    
    Signed-off-by: Stanislav Kinsburskiy <skinsbursky at virtuozzo.com>
---
 net/sunrpc/clnt.c | 18 ++++++++++++++++++
 1 file changed, 18 insertions(+)

diff --git a/net/sunrpc/clnt.c b/net/sunrpc/clnt.c
index 2635c49..8543de4 100644
--- a/net/sunrpc/clnt.c
+++ b/net/sunrpc/clnt.c
@@ -2537,6 +2537,20 @@ retry:
 EXPORT_SYMBOL_GPL(rpc_clnt_swap_deactivate);
 #endif /* CONFIG_SUNRPC_SWAP */
 
+static void rpc_kill_tasks(struct net *net)
+{
+	struct rpc_clnt *clnt;
+	struct sunrpc_net *sn = net_generic(net, sunrpc_net_id);
+
+	spin_lock(&sn->rpc_client_lock);
+	list_for_each_entry(clnt, &sn->all_clients, cl_clients) {
+		spin_lock(&clnt->cl_lock);
+		xprt_wake_pending_tasks(clnt->cl_xprt, -EIO);
+		spin_unlock(&clnt->cl_lock);
+	}
+	spin_unlock(&sn->rpc_client_lock);
+}
+
 static ssize_t write_kill_tasks(struct file *file, const char __user *buf,
 			 size_t count, loff_t *ppos)
 {
@@ -2556,6 +2570,10 @@ static ssize_t write_kill_tasks(struct file *file, const char __user *buf,
 	if (res)
 		return res;
 
+	/* Kill pending tasks */
+	if (kill_tasks && !sn->kill_tasks)
+		rpc_kill_tasks(net);
+
 	sn->kill_tasks = !!kill_tasks;
 	return count;
 }


More information about the Devel mailing list