There could be a situation, when RPC task is not yet sleeping, but already passed the check for "kill_tasks" in __rpc_execute(). There is a race in such a case, because task will fall into sleep anyway. This patch makes this probability a little bit less.
Signed-off-by: Stanislav Kinsburskiy <skinsbur...@virtuozzo.com> --- net/sunrpc/clnt.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/net/sunrpc/clnt.c b/net/sunrpc/clnt.c index 8543de4..94b0187 100644 --- a/net/sunrpc/clnt.c +++ b/net/sunrpc/clnt.c @@ -2556,6 +2556,7 @@ static ssize_t write_kill_tasks(struct file *file, const char __user *buf, { struct net *net = PDE_DATA(file->f_path.dentry->d_inode); struct sunrpc_net *sn = net_generic(net, sunrpc_net_id); + bool prev_kill_tasks = sn->kill_tasks; char tbuf[20]; unsigned long kill_tasks; int res; @@ -2570,11 +2571,12 @@ static ssize_t write_kill_tasks(struct file *file, const char __user *buf, if (res) return res; + sn->kill_tasks = !!kill_tasks; + /* Kill pending tasks */ - if (kill_tasks && !sn->kill_tasks) + if (sn->kill_tasks && !prev_kill_tasks) rpc_kill_tasks(net); - sn->kill_tasks = !!kill_tasks; return count; } _______________________________________________ Devel mailing list Devel@openvz.org https://lists.openvz.org/mailman/listinfo/devel