io_uring: SQPOLL parking fixes
authorJens Axboe <axboe@kernel.dk>
Sat, 6 Mar 2021 20:58:48 +0000 (13:58 -0700)
committerJens Axboe <axboe@kernel.dk>
Wed, 10 Mar 2021 14:28:22 +0000 (07:28 -0700)
commit05962f95f9ac7af25fea037ef51b37c0eccb5590
tree91c6a251a711dc36541b2d50560188bc73c72e83
parent041474885e9707a38fad081abe30159eb6d463f9
io_uring: SQPOLL parking fixes

We keep running into weird dependency issues between the sqd lock and
the parking state. Disentangle the SQPOLL thread from the last bits of
the kthread parking inheritance, and just replace the parking state,
and two associated locks, with a single rw mutex. The SQPOLL thread
keeps the mutex for read all the time, except if someone has marked us
needing to park. Then we drop/re-acquire and try again.

This greatly simplifies the parking state machine (by just getting rid
of it), and makes it a lot more obvious how it works - if you need to
modify the ctx list, then you simply park the thread which will grab
the lock for writing.

Fold in fix from Hillf Danton on not setting STOP on a fatal signal.

Fixes: e54945ae947f ("io_uring: SQPOLL stop error handling fixes")
Signed-off-by: Jens Axboe <axboe@kernel.dk>
fs/io_uring.c