Messages in this thread | | | From | Linus Torvalds <> | Date | Mon, 9 Dec 2019 10:03:11 -0800 | Subject | Re: Fundamental race condition in wait_event_interruptible_exclusive() ? |
| |
On Mon, Dec 9, 2019 at 9:38 AM Oleg Nesterov <oleg@redhat.com> wrote: > > > because we've added ourselves as an exclusive writer to the > > queue. So it _says_ it was interrupted, not woken up, and the wait got > > cancelled, but because we were an exclusive waiter, we might be the > > _only_ thing that got woken up, > > And that is why ___wait_event() always checks the condition after > prepare_to_wait_event(), whatever it returns.
Ack. I misread the code, and you're right - if we've been woken up, the condition is supposed to be true, and we never actually return -ERESTARTSYS.
So the situation of "got woken but returned error, and lost wakeup" won't actually ever happen.
Good.
So yeah, I can do what I wanted to do, and it should all work.
I never even tested it, because I was getting fairly anal about possible races in the pipe code by then.
Linus
| |