From: "Benjamin Coddington" <bcodding@redhat.com>
To: "Trond Myklebust" <trondmy@hammerspace.com>
Cc: Anna.Schumaker@netapp.com, linux-nfs@vger.kernel.org,
jamespharvey20@gmail.com
Subject: Re: [PATCH] SUNRPC: fix race to sk_err after xs_error_report
Date: Wed, 02 Oct 2019 06:41:44 -0400 [thread overview]
Message-ID: <605DFB04-3686-4CCE-A87E-905E91E01F50@redhat.com> (raw)
In-Reply-To: <d9bf3f1092ed0361cc344e04a915ea337a3aa9e8.camel@hammerspace.com>
On 1 Oct 2019, at 15:38, Trond Myklebust wrote:
> On Tue, 2019-10-01 at 14:30 -0400, Benjamin Coddington wrote:
>> ...
>> diff --git a/include/linux/sunrpc/xprtsock.h
>> b/include/linux/sunrpc/xprtsock.h
>> index 7638dbe7bc50..8ffae73dea6c 100644
>> --- a/include/linux/sunrpc/xprtsock.h
>> +++ b/include/linux/sunrpc/xprtsock.h
>> @@ -56,6 +56,7 @@ struct sock_xprt {
>> */
>> unsigned long sock_state;
>> struct delayed_work connect_worker;
>> + int xprt_err;
>
> Perhaps move this down just after srcport so we don't create an
> unnecessary hole in the structure?
Ok!
>> struct work_struct error_worker;
>> struct work_struct recv_worker;
>> struct mutex recv_mutex;
>> diff --git a/net/sunrpc/xprtsock.c b/net/sunrpc/xprtsock.c
>> index e2176c167a57..7fe77eef7080 100644
>> --- a/net/sunrpc/xprtsock.c
>> +++ b/net/sunrpc/xprtsock.c
>> @@ -1250,12 +1250,12 @@ static void xs_error_report(struct sock *sk)
>> goto out;
>>
>> transport = container_of(xprt, struct sock_xprt, xprt);
>> - err = -sk->sk_err;
>> - if (err == 0)
>> + transport->xprt_err = -sk->sk_err;
>
> Doesn't this need a smp write barrier to ensure it isn't reordered with
> the set_bit() in xs_run_error_worker()?
Yes, it does need that or the error_worker may clear the bit without seeing
the error.
Ben
prev parent reply other threads:[~2019-10-02 10:41 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-10-01 18:30 [PATCH] SUNRPC: fix race to sk_err after xs_error_report Benjamin Coddington
2019-10-01 19:38 ` Trond Myklebust
2019-10-02 10:41 ` Benjamin Coddington [this message]
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=605DFB04-3686-4CCE-A87E-905E91E01F50@redhat.com \
--to=bcodding@redhat.com \
--cc=Anna.Schumaker@netapp.com \
--cc=jamespharvey20@gmail.com \
--cc=linux-nfs@vger.kernel.org \
--cc=trondmy@hammerspace.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).