]> git.ipfire.org Git - thirdparty/kernel/linux.git/commit
io_uring/napi: clear tracked NAPI entries on unregister
authorYufan Chen <ericterminal@gmail.com>
Sun, 3 May 2026 17:56:10 +0000 (01:56 +0800)
committerJens Axboe <axboe@kernel.dk>
Mon, 4 May 2026 05:21:23 +0000 (23:21 -0600)
commitb8c2e9e27636b92dc96c12f16894cbc60c58a306
tree5f6bc96694df92c72f53eab40da00853328a7260
parent17666e2d7592c3e85260cafd3950121524acc2c5
io_uring/napi: clear tracked NAPI entries on unregister

IORING_UNREGISTER_NAPI disables NAPI busy polling, but it currently
leaves any previously tracked NAPI IDs on the ring context. The normal
wait path only checks whether the list is empty before entering the busy
poll helper, so an unregistered ring can still observe stale entries and
run an unexpected busy poll pass.

Make unregister switch the context to inactive and free the tracked
entries. Do the same inactive transition while changing the tracking
strategy, and recheck the expected tracking mode under napi_lock before
inserting a newly learned NAPI ID. This prevents a racing poll path from
repopulating the list after unregister or reconfiguration.

Also make the busy poll dispatcher ignore inactive mode explicitly.

Signed-off-by: Yufan Chen <ericterminal@gmail.com>
Fixes: 6bf90bd8c58a ("io_uring/napi: add static napi tracking strategy")
Link: https://patch.msgid.link/20260503175610.35521-1-yufan.chen@linux.dev
Signed-off-by: Jens Axboe <axboe@kernel.dk>
io_uring/napi.c
io_uring/napi.h