SUNRPC release the transport of a relocated task with an assigned transport
authorOlga Kornievskaia <kolga@netapp.com>
Thu, 21 Apr 2022 14:32:34 +0000 (10:32 -0400)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 12 May 2022 10:30:14 +0000 (12:30 +0200)
commit e13433b4416fa31a24e621cbbbb39227a3d651dd upstream.

A relocated task must release its previous transport.

Fixes: 82ee41b85cef1 ("SUNRPC don't resend a task on an offlined transport")
Signed-off-by: Olga Kornievskaia <kolga@netapp.com>
Signed-off-by: Trond Myklebust <trond.myklebust@hammerspace.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
net/sunrpc/clnt.c

index 3286add1a9583177581aa710a6765d5ce4e40751..e4b9a38f12e075c48d60cd920d5dc306f9eefb7f 100644 (file)
@@ -1065,10 +1065,13 @@ rpc_task_get_next_xprt(struct rpc_clnt *clnt)
 static
 void rpc_task_set_transport(struct rpc_task *task, struct rpc_clnt *clnt)
 {
-       if (task->tk_xprt &&
-                       !(test_bit(XPRT_OFFLINE, &task->tk_xprt->state) &&
-                        (task->tk_flags & RPC_TASK_MOVEABLE)))
-               return;
+       if (task->tk_xprt) {
+               if (!(test_bit(XPRT_OFFLINE, &task->tk_xprt->state) &&
+                     (task->tk_flags & RPC_TASK_MOVEABLE)))
+                       return;
+               xprt_release(task);
+               xprt_put(task->tk_xprt);
+       }
        if (task->tk_flags & RPC_TASK_NO_ROUND_ROBIN)
                task->tk_xprt = rpc_task_get_first_xprt(clnt);
        else