https://github.com/torvalds/linux
Revision f8b632e89a101dae349a7b212c1771d7925f441b authored by Pavel Begunkov on 24 July 2024, 11:16:16 UTC, committed by Jens Axboe on 24 July 2024, 14:01:49 UTC
io_uring_cancel_generic() should retry if any state changes like a request is completed, however in case of a task exit it only goes for another loop and avoids schedule() if any tracked (i.e. REQ_F_INFLIGHT) request got completed. Let's assume we have a non-tracked request executing in iowq and a tracked request linked to it. Let's also assume io_uring_cancel_generic() fails to find and cancel the request, i.e. via io_run_local_work(), which may happen as io-wq has gaps. Next, the request logically completes, io-wq still hold a ref but queues it for completion via tw, which happens in io_uring_try_cancel_requests(). After, right before prepare_to_wait() io-wq puts the request, grabs the linked one and tries executes it, e.g. arms polling. Finally the cancellation loop calls prepare_to_wait(), there are no tw to run, no tracked request was completed, so the tctx_inflight() check passes and the task is put to indefinite sleep. Cc: stable@vger.kernel.org Fixes: 3f48cf18f886c ("io_uring: unify files and task cancel") Signed-off-by: Pavel Begunkov <asml.silence@gmail.com> Link: https://lore.kernel.org/r/acac7311f4e02ce3c43293f8f1fda9c705d158f1.1721819383.git.asml.silence@gmail.com Signed-off-by: Jens Axboe <axboe@kernel.dk>
1 parent bcc87d9
Tip revision: f8b632e89a101dae349a7b212c1771d7925f441b authored by Pavel Begunkov on 24 July 2024, 11:16:16 UTC
io_uring: tighten task exit cancellations
io_uring: tighten task exit cancellations
Tip revision: f8b632e
File | Mode | Size |
---|---|---|
Documentation | ||
LICENSES | ||
arch | ||
block | ||
certs | ||
crypto | ||
drivers | ||
fs | ||
include | ||
init | ||
io_uring | ||
ipc | ||
kernel | ||
lib | ||
mm | ||
net | ||
rust | ||
samples | ||
scripts | ||
security | ||
sound | ||
tools | ||
usr | ||
virt | ||
.clang-format | -rw-r--r-- | 21.7 KB |
.cocciconfig | -rw-r--r-- | 59 bytes |
.editorconfig | -rw-r--r-- | 575 bytes |
.get_maintainer.ignore | -rw-r--r-- | 194 bytes |
.gitattributes | -rw-r--r-- | 105 bytes |
.gitignore | -rw-r--r-- | 2.0 KB |
.mailmap | -rw-r--r-- | 40.0 KB |
.rustfmt.toml | -rw-r--r-- | 369 bytes |
COPYING | -rw-r--r-- | 496 bytes |
CREDITS | -rw-r--r-- | 102.5 KB |
Kbuild | -rw-r--r-- | 2.5 KB |
Kconfig | -rw-r--r-- | 555 bytes |
MAINTAINERS | -rw-r--r-- | 752.7 KB |
Makefile | -rw-r--r-- | 66.5 KB |
README | -rw-r--r-- | 726 bytes |
Computing file changes ...