[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAHk-=wgs8E4JYVJHaRV2hMn3dxUnM8i0Kn2mA1SjzJdsbB9tXw@mail.gmail.com>
Date: Tue, 18 Feb 2020 09:54:58 -0800
From: Linus Torvalds <torvalds@...ux-foundation.org>
To: Andrei Vagin <avagin@...il.com>
Cc: LKML <linux-kernel@...r.kernel.org>,
Sasha Levin <sashal@...nel.org>,
stable <stable@...r.kernel.org>,
Josh Triplett <josh@...htriplett.org>,
linux-fsdevel <linux-fsdevel@...r.kernel.org>
Subject: Re: [PATCH AUTOSEL 5.5 542/542] pipe: use exclusive waits when
reading or writing
On Tue, Feb 18, 2020 at 9:36 AM Linus Torvalds
<torvalds@...ux-foundation.org> wrote:
>
> The things that change the number of readers or writers should simply
> use "wake_up_all()".
>
> So I think the right fix is the attached patch. Since you had such a
> lovely test-case, let me go test it too ;)
Good that I did. I missed the _real_ case of this - pipe_release().
Because that used a different wakeup function.
In fact, that case uses wake_up_interruptible_sync_poll(), which
doesn't have the "all" version.
But it doesn't actually need that fancy thing, since it's only meant
for "let's avoid waking up things that don't need these poll keys",
and the whole point is that now we're closing the pipe so we should
wake up everybody.
And in fact the test for "are there readers or writers" was
nonsensical. We shouldn't wake up readers just because they still
exist. We should wake up readers only if they exist, _and_ there are
no writers left (and vice versa).
Anyway, new patch attached. This hasn't been tested either, but I'll
let you know if it's broken too ;)
Linus
View attachment "patch.diff" of type "text/x-patch" (1916 bytes)
Powered by blists - more mailing lists