linux/Documentation/block
Josef Bacik 7bf71ecab1 ublk: refuse to go live after an io command was canceled
Since commit "ublk: keep a canceled FETCH round canceling until the
server is gone", a device whose FETCH round saw a cancel keeps its
queues canceling until the server goes away, but START_DEV and
END_USER_RECOVERY still bring it up. Without UBLK_F_USER_RECOVERY, or
with UBLK_F_USER_RECOVERY_FAIL_IO, every request of the new disk fails.
With UBLK_F_USER_RECOVERY, requests are requeued and never kicked: after
START_DEV the partition scan hangs under disk->open_mutex, and after
END_USER_RECOVERY every read parks while the command returned 0. The
server cannot fetch the canceled commands again, so the device can't
serve I/O until it restarts anyway.

Return -EBUSY from START_DEV and END_USER_RECOVERY while ub->canceling
is set. In ublk_ctrl_start_dev() check it and publish ub->ub_disk in one
cancel_mutex section, and have ublk_start_cancel() read the disk in its
cancel_mutex section. Today ublk_start_cancel() samples the disk before
taking the mutex, so a server dying during its own START_DEV can mark
the queues without quiescing a disk START_DEV published in between, with
its first I/O past the canceling check. Now either START_DEV sees the
cancel, or the cancel sees the disk and quiesces it before marking. The
END_USER_RECOVERY check is best effort: the disk exists there, and a
cancel after it is the ordinary death of the new server, which
ublk_start_cancel() handles by quiescing and marking.

Assisted-by: LLM
Reviewed-by: Ming Lei <tom.leiming@gmail.com>
Signed-off-by: Josef Bacik <josef@toxicpanda.com>
Signed-off-by: Ming Lei <tom.leiming@gmail.com>
Link: https://patch.msgid.link/20261011063555.1142277-9-tom.leiming@gmail.com
Signed-off-by: Jens Axboe <axboe@kernel.dk>
2026-10-15 18:25:35 -06:00
..
bfq-iosched.rst docs: block: Fix grammar and spelling mistakes in bfq-iosched.rst 2024-09-05 14:38:10 -06:00
biovecs.rst block: rename bi_bvec_done 2026-08-06 06:47:33 -06:00
blk-mq.rst docs: block: fix dead http link in blk-mq.rst 2026-08-24 11:01:06 -06:00
cmdline-partition.rst docs: block: Document support for read-only partition in cmdline part 2024-10-22 08:14:56 -06:00
data-integrity.rst docs: fix typos in kernel documentation 2026-04-27 04:03:52 -06:00
deadline-iosched.rst docs: block: convert to ReST 2019-07-15 09:20:27 -03:00
error-injection.rst block: add configurable error injection 2026-06-12 10:40:35 -06:00
index.rst block: add configurable error injection 2026-06-12 10:40:35 -06:00
inline-encryption.rst blk-crypto: Update docs for blk-crypto-fallback motivation 2026-07-20 10:39:26 -07:00
ioprio.rst Documentation: block: ioprio: Update schedulers 2024-01-18 08:21:14 -07:00
kyber-iosched.rst docs: block: convert to ReST 2019-07-15 09:20:27 -03:00
null_blk.rst null_blk: add module parameters for 4 options 2022-08-02 17:14:50 -06:00
pr.rst Documentation: block: eliminate duplicated word 2020-07-13 09:44:05 -06:00
stat.rst docs: block: fix stat.rst document error 2021-06-04 11:23:36 -06:00
switching-sched.rst Documenation: switching-sched: Remove notes about elevator argument 2019-09-03 08:04:02 -06:00
ublk.rst ublk: refuse to go live after an io command was canceled 2026-10-15 18:25:35 -06:00
writeback_cache_control.rst block: fix spelling and grammar for in writeback_cache_control.rst 2024-06-20 06:53:14 -06:00