[Devel] [PATCH RHEL7 COMMIT] sunrpc: do not place task to sleep if has to be killed
Konstantin Khorenko
khorenko at virtuozzo.com
Tue Jul 11 18:34:01 MSK 2017
The commit is pushed to "branch-rh7-3.10.0-514.26.1.vz7.33.x-ovz" and will appear at https://src.openvz.org/scm/ovz/vzkernel.git
after rh7-3.10.0-514.26.1.vz7.33.3
------>
commit 7ad31749d6f0f63baa860aacf5e134affdcd85e3
Author: Stanislav Kinsburskiy <skinsbursky at virtuozzo.com>
Date: Tue Jul 11 19:34:00 2017 +0400
sunrpc: do not place task to sleep if has to be killed
There might be a situation, when task is expected to be killed, but it's
execution already passed this check in __rpc_execute() and the task is not yet
sleeping. In this case it will fall into sleep. I.e. it's a race.
This patch add check for per-net "kill_tasks" is enabled before going to
sleep.
What's good here, is that this check is done with queue->lock being held.
And tasks killing is also performed with the same lock being held.
IOW, this lock is a synchronization point, which guarantees us that task will
either die by itself or killed.
https://jira.sw.ru/browse/PSBM-68214
Signed-off-by: Stanislav Kinsburskiy <skinsbursky at virtuozzo.com>
---
net/sunrpc/sched.c | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/net/sunrpc/sched.c b/net/sunrpc/sched.c
index cd41946..a551111 100644
--- a/net/sunrpc/sched.c
+++ b/net/sunrpc/sched.c
@@ -354,6 +354,12 @@ static void __rpc_sleep_on_priority(struct rpc_wait_queue *q,
rpc_action action,
unsigned char queue_priority)
{
+ if (rpc_abort_task(task)) {
+ task->tk_flags |= RPC_TASK_KILLED;
+ rpc_exit(task, -EIO);
+ return;
+ }
+
dprintk("RPC: %5u sleep_on(queue \"%s\" time %lu)\n",
task->tk_pid, rpc_qname(q), jiffies);
More information about the Devel
mailing list