]> git.ipfire.org Git - thirdparty/kernel/linux.git/commit
ublk: introduce and use ublk_set_canceling helper
authorUday Shankar <ushankar@purestorage.com>
Fri, 4 Jul 2025 05:41:08 +0000 (23:41 -0600)
committerJens Axboe <axboe@kernel.dk>
Fri, 4 Jul 2025 15:30:16 +0000 (09:30 -0600)
commit10d77a8c60b2b117868a64875a55c4c8db6f1f2e
tree2af7469a87f74d29f93873db2cf3c1cf31aa5f70
parent2fa9c93035e17380cafa897ee1a4d503881a3770
ublk: introduce and use ublk_set_canceling helper

For performance reasons (minimizing the number of cache lines accessed
in the hot path), we store the "canceling" state redundantly - there is
one flag in the device, which can be considered the source of truth, and
per-queue copies of that flag. This redundancy can cause confusion, and
opens the door to bugs where the state is set inconsistently. Try to
guard against these bugs by introducing a ublk_set_canceling helper
which is the sole mutator of both the per-device and per-queue canceling
state. This helper always sets the state consistently. Use the helper in
all places where we need to modify the canceling state.

No functional changes are expected.

Signed-off-by: Uday Shankar <ushankar@purestorage.com>
Reviewed-by: Ming Lei <ming.lei@redhat.com>
Link: https://lore.kernel.org/r/20250703-ublk_too_many_quiesce-v2-2-3527b5339eeb@purestorage.com
Signed-off-by: Jens Axboe <axboe@kernel.dk>
drivers/block/ublk_drv.c