netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Eric Dumazet <eric.dumazet@gmail.com>
To: Davide Libenzi <davidel@xmailserver.org>
Cc: Oleg Nesterov <oleg@redhat.com>, Jiri Olsa <jolsa@redhat.com>,
	netdev@vger.kernel.org,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
	fbl@redhat.com, nhorman@redhat.com, davem@redhat.com,
	Tejun Heo <htejun@gmail.com>
Subject: Re: [PATCH] net: fix race in the receive/select
Date: Fri, 26 Jun 2009 04:19:31 +0200	[thread overview]
Message-ID: <4A443033.8060401@gmail.com> (raw)
In-Reply-To: <alpine.DEB.1.10.0906251858520.9517@makko.or.mcafeemobile.com>

Davide Libenzi a écrit :
> On Fri, 26 Jun 2009, Eric Dumazet wrote:
> 
>> Davide Libenzi a écrit :
>>> On Thu, 25 Jun 2009, Oleg Nesterov wrote:
>>>
>>>> Can't really comment this patch, except this all looks reasonable to me.
>>>> Add more CCs.
>>> While this can work, IMO it'd be cleaner to have the smp_mb() moved from 
>>> fs/select.c to the ->poll() function.
>>> Having a barrier that matches another one in another susbsystem, because 
>>> of the special locking logic of such subsystem, is not too shiny IMHO.
>>>
>> Yes but barrier is necessary only if add_wait_queue() was actually called, and __pollwait()
>> does this call.
>>
>> Adding a plain smp_mb() in tcp_poll() for example would slowdown select()/poll() with NULL
>> timeout.
> 
> Do you think of it as good design adding an MB on a subsystem, because of 
> the special locking logic of another one?
> The (eventual) slowdown, IMO can be argued sideways, by saying that 
> non-socket users will pay the price for their polls.
> 

I wont argue with you David, just try to correct bugs.

fs/ext4/ioctl.c line 182

	set_current_state(TASK_INTERRUPTIBLE);
	add_wait_queue(&EXT4_SB(sb)->ro_wait_queue, &wait);
	if (timer_pending(&EXT4_SB(sb)->turn_ro_timer)) {
		schedule();

Another example of missing barrier after add_wait_queue()

Because add_wait_queue() misses a barrier, we have to add one after each call.

Maybe it would be safer to add barrier in add_wait_queue() itself, not in _pollwait().


  parent reply	other threads:[~2009-06-26  2:20 UTC|newest]

Thread overview: 37+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-06-25 12:25 [PATCH] net: fix race in the receive/select Jiri Olsa
2009-06-25 12:24 ` Oleg Nesterov
2009-06-26  1:31   ` Davide Libenzi
2009-06-26  1:59     ` Eric Dumazet
2009-06-26  2:04       ` Davide Libenzi
2009-06-26  2:11         ` David Miller
2009-06-26  2:19         ` Eric Dumazet [this message]
2009-06-26  3:14           ` Davide Libenzi
2009-06-26  5:42             ` Jarek Poplawski
2009-06-26  8:10               ` Jarek Poplawski
2009-06-26 13:57             ` Oleg Nesterov
2009-06-26 17:32               ` Davide Libenzi
2009-06-26 14:50                 ` Oleg Nesterov
2009-06-26 18:12                   ` Davide Libenzi
2009-06-26 18:17                     ` David Miller
2009-06-26 19:35                       ` Eric Dumazet
2009-06-29  9:34                         ` Jiri Olsa
2009-06-28 11:10                   ` Jarek Poplawski
2009-06-28 11:22                     ` Jarek Poplawski
2009-06-28 18:04                       ` Oleg Nesterov
2009-06-28 21:48                         ` Jarek Poplawski
2009-06-29  9:27                           ` Jiri Olsa
2009-06-26 13:46           ` Oleg Nesterov
2009-06-25 23:18 ` Eric Dumazet
2009-06-26  1:50 ` Tejun Heo
2009-06-29  9:12 ` Andi Kleen
2009-06-29  9:24   ` Jiri Olsa
2009-06-29 16:59   ` Zan Lynx
2009-06-29 17:29     ` Andi Kleen
2009-07-01  3:39   ` Herbert Xu
2009-07-01  6:27     ` Andi Kleen
2009-07-01  7:03       ` Herbert Xu
2009-07-01  7:22         ` Andi Kleen
2009-07-01  8:31           ` Herbert Xu
2009-07-01  8:44             ` Jiri Olsa
2009-07-01 10:58               ` Herbert Xu
2009-07-01 13:07                 ` Herbert Xu

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=4A443033.8060401@gmail.com \
    --to=eric.dumazet@gmail.com \
    --cc=davem@redhat.com \
    --cc=davidel@xmailserver.org \
    --cc=fbl@redhat.com \
    --cc=htejun@gmail.com \
    --cc=jolsa@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=nhorman@redhat.com \
    --cc=oleg@redhat.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).