From: Jeff Layton <jlayton@poochiereds.net>
To: Trond Myklebust <trond.myklebust@primarydata.com>
Cc: "Suzuki K. Poulose" <suzuki.poulose@arm.com>,
Anna Schumaker <anna.schumaker@netapp.com>,
"J. Bruce Fields" <bfields@fieldses.org>,
"David S. Miller" <davem@davemloft.net>,
Linux NFS Mailing List <linux-nfs@vger.kernel.org>,
Linux Kernel Mailing List <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] SUNRPC: Fix a race in xs_reset_transport
Date: Thu, 17 Sep 2015 10:18:47 -0400 [thread overview]
Message-ID: <20150917101847.74ee85ac@synchrony.poochiereds.net> (raw)
In-Reply-To: <CAHQdGtTzHbuBQTdW7vfxpOzET8hOQrXV-AE1Px7rNwu1zBMKNw@mail.gmail.com>
On Thu, 17 Sep 2015 09:38:33 -0400
Trond Myklebust <trond.myklebust@primarydata.com> wrote:
> On Tue, Sep 15, 2015 at 2:52 PM, Jeff Layton <jlayton@poochiereds.net> wrote:
> > On Tue, 15 Sep 2015 16:49:23 +0100
> > "Suzuki K. Poulose" <suzuki.poulose@arm.com> wrote:
> >
> >> net/sunrpc/xprtsock.c | 9 ++++++++-
> >> 1 file changed, 8 insertions(+), 1 deletion(-)
> >>
> >> diff --git a/net/sunrpc/xprtsock.c b/net/sunrpc/xprtsock.c
> >> index 7be90bc..6f4789d 100644
> >> --- a/net/sunrpc/xprtsock.c
> >> +++ b/net/sunrpc/xprtsock.c
> >> @@ -822,9 +822,16 @@ static void xs_reset_transport(struct sock_xprt *transport)
> >> if (atomic_read(&transport->xprt.swapper))
> >> sk_clear_memalloc(sk);
> >>
> >> - kernel_sock_shutdown(sock, SHUT_RDWR);
> >> + if (sock)
> >> + kernel_sock_shutdown(sock, SHUT_RDWR);
> >>
> >
> > Good catch, but...isn't this still racy? What prevents transport->sock
> > being set to NULL after you assign it to "sock" but before calling
> > kernel_sock_shutdown?
>
> The XPRT_LOCKED state.
>
IDGI -- if the XPRT_LOCKED bit was supposed to prevent that, then
how could you hit the original race? There should be no concurrent
callers to xs_reset_transport on the same xprt, right?
AFAICT, that bit is not set in the xprt_destroy codepath, which may be
the root cause of the problem. How would we take it there anyway?
xprt_destroy is void return, and may not be called in the context of a
rpc_task. If it's contended, what do we do? Sleep until it's cleared?
--
Jeff Layton <jlayton@poochiereds.net>
next prev parent reply other threads:[~2015-09-17 14:18 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-09-15 15:49 [PATCH] SUNRPC: Fix a race in xs_reset_transport Suzuki K. Poulose
2015-09-15 18:52 ` Jeff Layton
2015-09-16 8:08 ` Suzuki K. Poulose
2015-09-16 9:04 ` [PATCHv2] " Suzuki K. Poulose
2015-09-16 9:35 ` Suzuki K. Poulose
2015-09-16 9:48 ` Marc Zyngier
2015-09-16 11:17 ` Jeff Layton
2015-09-18 11:19 ` Suzuki K. Poulose
2015-09-18 16:51 ` Trond Myklebust
2015-09-18 22:00 ` Trond Myklebust
[not found] ` <20150919080812.063ebf1b@synchrony.poochiereds.net>
2015-09-19 15:07 ` Trond Myklebust
2015-09-21 13:48 ` Suzuki K. Poulose
2015-09-17 13:38 ` [PATCH] " Trond Myklebust
2015-09-17 14:18 ` Jeff Layton [this message]
2015-09-17 14:50 ` Trond Myklebust
2015-09-17 14:59 ` Jeff Layton
2015-09-18 11:16 ` Suzuki K. Poulose
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=20150917101847.74ee85ac@synchrony.poochiereds.net \
--to=jlayton@poochiereds.net \
--cc=anna.schumaker@netapp.com \
--cc=bfields@fieldses.org \
--cc=davem@davemloft.net \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-nfs@vger.kernel.org \
--cc=suzuki.poulose@arm.com \
--cc=trond.myklebust@primarydata.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;
as well as URLs for NNTP newsgroup(s).