io_uring: fail io-wq submission from a task_work
authorPavel Begunkov <asml.silence@gmail.com>
Thu, 18 Feb 2021 22:32:52 +0000 (22:32 +0000)
committerJens Axboe <axboe@kernel.dk>
Sun, 21 Feb 2021 02:01:35 +0000 (19:01 -0700)
commita3df769899c0bdc224c94d1d8cc9cbb3f3a72553
treedd5dbb26d53838626dea7bc62bd919a3a9b17520
parent792bb6eb862333658bf1bd2260133f0507e2da8d
io_uring: fail io-wq submission from a task_work

In case of failure io_wq_submit_work() needs to post an CQE and so
potentially take uring_lock. The safest way to deal with it is to do
that from under task_work where we can safely take the lock.

Also, as io_iopoll_check() holds the lock tight and releases it
reluctantly, it will play nicer in the furuter with notifying an
iopolling task about new such pending failed requests.

Signed-off-by: Pavel Begunkov <asml.silence@gmail.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
fs/io_uring.c