Skip to content

ublk: refuse to go live after an io command was canceled - #1405

Open
blktests-ci-kpd[bot] wants to merge 1 commit into
linus-master_basefrom
series/1180451=>linus-master
Open

blktests-ci-kpd[bot] wants to merge 1 commit into
linus-master_basefrom
series/1180451=>linus-master

Conversation

@blktests-ci-kpd

Copy link
Copy Markdown

Pull request for series with
subject: ublk: refuse to go live after an io command was canceled
version: 1
url: https://patchwork.kernel.org/series/1179842/

@blktests-ci-kpd

Copy link
Copy Markdown
Author

Upstream branch: 69f80fe
series: https://patchwork.kernel.org/series/1179842/
version: 1

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 -ENODEV 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
Signed-off-by: Josef Bacik <josef@toxicpanda.com>
Reviewed-by: Ming Lei <tom.leiming@gmail.com>
@blktests-ci-kpd

Copy link
Copy Markdown
Author

Upstream branch: 7b63ef2
series: https://patchwork.kernel.org/series/1179842/
version: 1

@blktests-ci-kpd
blktests-ci-kpd Bot force-pushed the series/1180451=>linus-master branch from 1e33bd3 to 79cffe2 Compare October 7, 2026 15:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant