]> git.baikalelectronics.ru Git - kernel.git/commit
io_uring: make SQPOLL thread parking saner
authorJens Axboe <axboe@kernel.dk>
Fri, 5 Mar 2021 15:44:39 +0000 (08:44 -0700)
committerJens Axboe <axboe@kernel.dk>
Fri, 5 Mar 2021 15:44:39 +0000 (08:44 -0700)
commit144c4d6622316c3b74e8d1f24a990d2d1ef788b0
tree7f4c0cd460986806724361175382efb35d7ced6b
parente0554980a680b7eeb05aec019df9fb10c34c334a
io_uring: make SQPOLL thread parking saner

We have this weird true/false return from parking, and then some of the
callers decide to look at that. It can lead to unbalanced parks and
sqd locking. Have the callers check the thread status once it's parked.
We know we have the lock at that point, so it's either valid or it's NULL.

Fix race with parking on thread exit. We need to be careful here with
ordering of the sdq->lock and the IO_SQ_THREAD_SHOULD_PARK bit.

Rename sqd->completion to sqd->parked to reflect that this is the only
thing this completion event doesn.

Signed-off-by: Jens Axboe <axboe@kernel.dk>
fs/io_uring.c