From: Neil Brown <nfbrown@novell.com>
To: Kosuke Tatsukawa <tatsu@ab.jp.nec.com>,
Trond Myklebust <trond.myklebust@primarydata.com>,
Anna Schumaker <anna.schumaker@netapp.com>,
"J. Bruce Fields" <bfields@fieldses.org>,
Jeff Layton <jlayton@poochiereds.net>,
"David S. Miller" <davem@davemloft.net>
Cc: "linux-nfs\@vger.kernel.org" <linux-nfs@vger.kernel.org>,
"netdev\@vger.kernel.org" <netdev@vger.kernel.org>,
"linux-kernel\@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH v2] sunrpc: fix waitqueue_active without memory barrier in sunrpc
Date: Fri, 09 Oct 2015 16:56:06 +1100 [thread overview]
Message-ID: <87h9m04mbt.fsf@notabene.neil.brown.name> (raw)
In-Reply-To: <17EC94B0A072C34B8DCF0D30AD16044A028748C0@BPXM09GP.gisp.nec.co.jp>
[-- Attachment #1: Type: text/plain, Size: 1551 bytes --]
Kosuke Tatsukawa <tatsu@ab.jp.nec.com> writes:
> There are several places in net/sunrpc/svcsock.c which calls
> waitqueue_active() without calling a memory barrier. Add a memory
> barrier just as in wq_has_sleeper().
>
> I found this issue when I was looking through the linux source code
> for places calling waitqueue_active() before wake_up*(), but without
> preceding memory barriers, after sending a patch to fix a similar
> issue in drivers/tty/n_tty.c (Details about the original issue can be
> found here: https://lkml.org/lkml/2015/9/28/849).
hi,
this feels like the wrong approach to the problem. It requires extra
'smb_mb's to be spread around which are hard to understand as easy to
forget.
A quick look seems to suggest that (nearly) every waitqueue_active()
will need an smb_mb. Could we just put the smb_mb() inside
waitqueue_active()??
Thanks,
NeilBrown
>
> Signed-off-by: Kosuke Tatsukawa <tatsu@ab.jp.nec.com>
> ---
> v2:
> - Fixed compiler warnings caused by type mismatch
> v1:
> - https://lkml.org/lkml/2015/10/8/993
> ---
> net/sunrpc/svcsock.c | 6 ++++++
> 1 files changed, 6 insertions(+), 0 deletions(-)
>
> diff --git a/net/sunrpc/svcsock.c b/net/sunrpc/svcsock.c
> index 0c81202..ec19444 100644
> --- a/net/sunrpc/svcsock.c
> +++ b/net/sunrpc/svcsock.c
> @@ -414,6 +414,7 @@ static void svc_udp_data_ready(struct sock *sk)
> set_bit(XPT_DATA, &svsk->sk_xprt.xpt_flags);
> svc_xprt_enqueue(&svsk->sk_xprt);
> }
> + smp_mb();
> if (wq && waitqueue_active(wq))
> wake_up_interruptible(wq);
> }
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 818 bytes --]
next prev parent reply other threads:[~2015-10-09 5:56 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-10-09 1:44 [PATCH v2] sunrpc: fix waitqueue_active without memory barrier in sunrpc Kosuke Tatsukawa
2015-10-09 5:56 ` Neil Brown [this message]
[not found] ` <87h9m04mbt.fsf-wvvUuzkyo1HefUI2i7LXDhCRmIWqnp/j@public.gmane.org>
2015-10-09 6:29 ` Kosuke Tatsukawa
2015-10-09 21:18 ` J. Bruce Fields
2015-10-09 21:21 ` Trond Myklebust
[not found] ` <20151009211819.GE8188-uC3wQj2KruNg9hUCZPvPmw@public.gmane.org>
2015-10-12 10:41 ` Kosuke Tatsukawa
2015-10-12 20:26 ` J. Bruce Fields
2015-10-14 3:57 ` Kosuke Tatsukawa
[not found] ` <17EC94B0A072C34B8DCF0D30AD16044A02877996-9lrffkYxhwTt6d3pZDjeaEtBU8KWyXPq@public.gmane.org>
2015-10-14 16:00 ` J. Bruce Fields
2015-10-15 0:09 ` Kosuke Tatsukawa
[not found] ` <17EC94B0A072C34B8DCF0D30AD16044A02877D53-9lrffkYxhwTt6d3pZDjeaEtBU8KWyXPq@public.gmane.org>
2015-10-15 11:44 ` Kosuke Tatsukawa
2015-10-15 20:57 ` J. Bruce Fields
2015-10-16 0:49 ` Neil Brown
[not found] ` <20151015205742.GB20155-uC3wQj2KruNg9hUCZPvPmw@public.gmane.org>
2015-10-16 1:46 ` Kosuke Tatsukawa
[not found] ` <17EC94B0A072C34B8DCF0D30AD16044A0287864B-9lrffkYxhwTt6d3pZDjeaEtBU8KWyXPq@public.gmane.org>
2015-10-16 2:28 ` Kosuke Tatsukawa
2015-10-22 16:31 ` J. Bruce Fields
[not found] ` <20151022163133.GB5205-uC3wQj2KruNg9hUCZPvPmw@public.gmane.org>
2015-10-23 4:14 ` Kosuke Tatsukawa
[not found] ` <17EC94B0A072C34B8DCF0D30AD16044A0287A7C2-9lrffkYxhwTt6d3pZDjeaEtBU8KWyXPq@public.gmane.org>
2015-10-23 20:49 ` J. Bruce Fields
[not found] ` <20151023204945.GD16137-uC3wQj2KruNg9hUCZPvPmw@public.gmane.org>
2015-10-24 1:19 ` Kosuke Tatsukawa
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=87h9m04mbt.fsf@notabene.neil.brown.name \
--to=nfbrown@novell.com \
--cc=anna.schumaker@netapp.com \
--cc=bfields@fieldses.org \
--cc=davem@davemloft.net \
--cc=jlayton@poochiereds.net \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-nfs@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=tatsu@ab.jp.nec.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).