2022-04-22 13:27:28

by Olga Kornievskaia

[permalink] [raw]
Subject: [PATCH v2 1/1] SUNRPC release the transport of a relocated task with an assigned transport

From: Olga Kornievskaia <[email protected]>

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 <[email protected]>
---
net/sunrpc/clnt.c | 10 +++++++---
1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/net/sunrpc/clnt.c b/net/sunrpc/clnt.c
index af0174d7ce5a..7fb3cdef2a60 100644
--- a/net/sunrpc/clnt.c
+++ b/net/sunrpc/clnt.c
@@ -1065,10 +1065,14 @@ 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)))
+ if (task->tk_xprt) {
+ if (!(test_bit(XPRT_OFFLINE, &task->tk_xprt->state) &&
+ (task->tk_flags & RPC_TASK_MOVEABLE))) {
+ xprt_release(task);
+ xprt_put(task->tk_xprt);
+ }
return;
+ }
if (task->tk_flags & RPC_TASK_NO_ROUND_ROBIN)
task->tk_xprt = rpc_task_get_first_xprt(clnt);
else
--
2.27.0


2022-04-22 22:25:37

by Trond Myklebust

[permalink] [raw]
Subject: Re: [PATCH v2 1/1] SUNRPC release the transport of a relocated task with an assigned transport

On Wed, 2022-04-20 at 16:23 -0400, Olga Kornievskaia wrote:
> From: Olga Kornievskaia <[email protected]>
>
> 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 <[email protected]>
> ---
>  net/sunrpc/clnt.c | 10 +++++++---
>  1 file changed, 7 insertions(+), 3 deletions(-)
>
> diff --git a/net/sunrpc/clnt.c b/net/sunrpc/clnt.c
> index af0174d7ce5a..7fb3cdef2a60 100644
> --- a/net/sunrpc/clnt.c
> +++ b/net/sunrpc/clnt.c
> @@ -1065,10 +1065,14 @@ 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)))
> +       if (task->tk_xprt) {
> +               if (!(test_bit(XPRT_OFFLINE, &task->tk_xprt->state)
> &&
> +                       (task->tk_flags & RPC_TASK_MOVEABLE))) {
> +                       xprt_release(task);
> +                       xprt_put(task->tk_xprt);
> +               }
>                 return;
> +       }

???? This may call for a v3. I think you may have intended something like

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

--
Trond Myklebust
Linux NFS client maintainer, Hammerspace
[email protected]