From: Trond Myklebust <trondmy@hammerspace.com>
To: "linux-nfs@vger.kernel.org" <linux-nfs@vger.kernel.org>,
"schumaker.anna@gmail.com" <schumaker.anna@gmail.com>
Cc: "Anna.Schumaker@Netapp.com" <Anna.Schumaker@Netapp.com>
Subject: Re: [PATCH v2 4/5] sunrpc: Prepare xs_connect() for taking NULL tasks
Date: Tue, 2 Feb 2021 21:59:36 +0000 [thread overview]
Message-ID: <67497ea4a7d22726112e0083893e85a17f1ca681.camel@hammerspace.com> (raw)
In-Reply-To: <4eaf0c288d97a2d03c5cd2a7ed728a73085b2719.camel@hammerspace.com>
On Tue, 2021-02-02 at 16:49 -0500, Trond Myklebust wrote:
> On Tue, 2021-02-02 at 13:42 -0500, schumaker.anna@gmail.com wrote:
> > From: Anna Schumaker <Anna.Schumaker@Netapp.com>
> >
> > We won't have a task structure when we go to change IP addresses,
> > so
> > check for one before calling the WARN_ON() to avoid crashing.
> >
> > Signed-off-by: Anna Schumaker <Anna.Schumaker@Netapp.com>
> > ---
> > net/sunrpc/xprtsock.c | 3 ++-
> > 1 file changed, 2 insertions(+), 1 deletion(-)
> >
> > diff --git a/net/sunrpc/xprtsock.c b/net/sunrpc/xprtsock.c
> > index c56a66cdf4ac..250abf1aa018 100644
> > --- a/net/sunrpc/xprtsock.c
> > +++ b/net/sunrpc/xprtsock.c
> > @@ -2311,7 +2311,8 @@ static void xs_connect(struct rpc_xprt *xprt,
> > struct rpc_task *task)
> > struct sock_xprt *transport = container_of(xprt, struct
> > sock_xprt, xprt);
> > unsigned long delay = 0;
> >
> > - WARN_ON_ONCE(!xprt_lock_connect(xprt, task, transport));
> > + if (task)
> > + WARN_ON_ONCE(!xprt_lock_connect(xprt, task,
> > transport));
>
> Nit: That's the same as
> WARN_ON_ONCE(task && !xprt_lock_connect(xprt, task, transport));
>
> >
> > if (transport->sock != NULL) {
> > dprintk("RPC: xs_connect delayed xprt %p for
> > %lu "
>
So, the problem with this patch is that you're deliberately
circumventing the process of locking the socket. That's not going to
work.
What you could do is follow the example set by xprt_destroy() and
xs_enable_swap(), to call wait_on_bit_lock() when there is no task.
That should work, but you'd better make sure that your process holds a
reference to the xprt->kref before doing that, or else you could easily
end up deadlocking with xprt_destroy().
--
Trond Myklebust
Linux NFS client maintainer, Hammerspace
trond.myklebust@hammerspace.com
next prev parent reply other threads:[~2021-02-02 22:00 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-02-02 18:42 [PATCH v2 0/5] SUNRPC: Create sysfs files for changing IP schumaker.anna
2021-02-02 18:42 ` [PATCH v2 1/5] sunrpc: Create a sunrpc directory under /sys/kernel/ schumaker.anna
2021-02-02 18:42 ` [PATCH v2 2/5] sunrpc: Create a net/ subdirectory in the sunrpc sysfs schumaker.anna
2021-02-02 18:42 ` [PATCH v2 3/5] sunrpc: Create per-rpc_clnt sysfs kobjects schumaker.anna
2021-02-02 18:42 ` [PATCH v2 4/5] sunrpc: Prepare xs_connect() for taking NULL tasks schumaker.anna
2021-02-02 21:49 ` Trond Myklebust
2021-02-02 21:59 ` Trond Myklebust [this message]
2021-02-05 18:33 ` Anna Schumaker
2021-02-02 18:42 ` [PATCH v2 5/5] sunrpc: Create a per-rpc_clnt file for managing the destination IP address schumaker.anna
2021-02-02 18:51 ` [PATCH v2 0/5] SUNRPC: Create sysfs files for changing IP Chuck Lever
2021-02-02 18:52 ` Anna Schumaker
2021-02-02 19:24 ` Dan Aloni
2021-02-02 19:46 ` Chuck Lever
2021-02-02 19:51 ` Anna Schumaker
2021-02-02 19:49 ` Benjamin Coddington
2021-02-02 22:17 ` Trond Myklebust
2021-02-02 22:21 ` Chuck Lever
2021-02-02 22:24 ` Trond Myklebust
2021-02-02 22:31 ` Chuck Lever
2021-02-03 21:20 ` Dan Aloni
2021-02-14 17:41 ` Dan Aloni
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=67497ea4a7d22726112e0083893e85a17f1ca681.camel@hammerspace.com \
--to=trondmy@hammerspace.com \
--cc=Anna.Schumaker@Netapp.com \
--cc=linux-nfs@vger.kernel.org \
--cc=schumaker.anna@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox