io-wq: fix queue stalling race
authorJens Axboe <axboe@kernel.dk>
Tue, 31 Aug 2021 19:53:00 +0000 (13:53 -0600)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 17 Nov 2021 10:04:47 +0000 (11:04 +0100)
commit9f9d088a4b7d0b6451e9cdd5225d7b192608ca38
tree924855724b36c714841db23295bb3938d1317d6f
parent92b69466102b456c58ae9725540013f893850b6d
io-wq: fix queue stalling race

commit 0242f6426ea78fbe3933b44f8c55ae93ec37f6cc upstream.

We need to set the stalled bit early, before we drop the lock for adding
us to the stall hash queue. If not, then we can race with new work being
queued between adding us to the stall hash and io_worker_handle_work()
marking us stalled.

Signed-off-by: Jens Axboe <axboe@kernel.dk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
fs/io-wq.c