The commit is pushed to "branch-rh10-6.12.0-211.16.1.12.x.vz10-ovz" and will 
appear at [email protected]:openvz/vzkernel.git
after rh10-6.12.0-211.16.1.12.1.vz10
------>
commit 6267eda9fbf65ac87cbd707c9b5f6196443c4f54
Author: Vladimir Riabchun <[email protected]>
Date:   Fri Jun 5 18:33:47 2026 +0000

    ve/sunrpc: Refactor {rpc, write}_kill_tasks
    
    1. Rename rpc_kill_tasks to rpc_set_kill_net and add value parameter,
       so that function can now both enable and disable RPC traffic.
    2. Move sn->kill_tasks check to rpc_set_kill_net so that
       file write function is only responsible for parsing and calling,
       not for logic checks.
    
    This will allow later usage of rpc_set_kill_net without
    kill_tasks check duplication.
    
    https://virtuozzo.atlassian.net/browse/VSTOR-126316
    
    Feature: nfs/nfsd: containerization
    Signed-off-by: Vladimir Riabchun <[email protected]>
    Reviewed-by: Pavel Tikhomirov <[email protected]>
---
 net/sunrpc/clnt.c | 35 ++++++++++++++++++++---------------
 1 file changed, 20 insertions(+), 15 deletions(-)

diff --git a/net/sunrpc/clnt.c b/net/sunrpc/clnt.c
index 1e85267bf9a82..d794a4af01bcd 100644
--- a/net/sunrpc/clnt.c
+++ b/net/sunrpc/clnt.c
@@ -3433,15 +3433,32 @@ rpc_clnt_swap_deactivate(struct rpc_clnt *clnt)
 EXPORT_SYMBOL_GPL(rpc_clnt_swap_deactivate);
 #endif /* CONFIG_SUNRPC_SWAP */
 
-static void rpc_kill_tasks(struct net *net)
+static void rpc_set_kill_net(struct net *net, bool new_value)
 {
        struct rpc_clnt *clnt;
        struct sunrpc_net *sn = net_generic(net, sunrpc_net_id);
+       if (sn->kill_tasks == new_value)
+               return;
+
+       sn->kill_tasks = new_value;
+       if (!new_value) {
+               pr_info_ratelimited(
+                       "task (%s:%d) cleared RPC kill_tasks in net [%u]\n",
+                       current->comm, current->pid, net->ns.inum);
+               return;
+       }
 
        spin_lock(&sn->rpc_client_lock);
        list_for_each_entry(clnt, &sn->all_clients, cl_clients)
                rpc_killall_tasks(clnt);
        spin_unlock(&sn->rpc_client_lock);
+
+       pr_info_ratelimited("task (%s:%d) killed RPC in net:[%u]%s\n",
+                           current->comm, current->pid, net->ns.inum,
+#ifdef CONFIG_VE
+                           net->owner_ve == &ve0 ? "(host)" :
+#endif
+                           "");
 }
 
 static ssize_t write_kill_tasks(struct file *file, const char __user *buf,
@@ -3449,7 +3466,6 @@ 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;
@@ -3464,19 +3480,8 @@ 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 (sn->kill_tasks && !prev_kill_tasks) {
-               rpc_kill_tasks(net);
-               pr_info_ratelimited(
-                       "kill-tasks: by task (%s:%d) in net:[%u]%s\n",
-                       current->comm, current->pid, net->ns.inum,
-#ifdef CONFIG_VE
-                       net->owner_ve == &ve0 ? "(host)" :
-#endif
-                       "");
-       }
+       /* Kill pending tasks or forget about previous murder */
+       rpc_set_kill_net(net, kill_tasks);
 
        return count;
 }
_______________________________________________
Devel mailing list
[email protected]
https://lists.openvz.org/mailman/listinfo/devel

Reply via email to