block: validate bios against queue limits in the entered context#854
block: validate bios against queue limits in the entered context#854blktests-ci[bot] wants to merge 5 commits into
Conversation
|
Upstream branch: 70eda68 |
|
Upstream branch: 70eda68 |
8e62e65 to
9a05b78
Compare
|
Upstream branch: 70eda68 |
9a05b78 to
42ddffe
Compare
|
Upstream branch: 70eda68 |
42ddffe to
c181c78
Compare
ca57796 to
c1feb59
Compare
|
Upstream branch: 8bc67e4 |
c181c78 to
380d429
Compare
c1feb59 to
ea833a1
Compare
|
Upstream branch: 6779b50 |
380d429 to
9e9a5cd
Compare
ea833a1 to
7af85d1
Compare
A bio requesting sectors unaligned to the logical format is invalid rather than an IO error. Fix up the return code because there are some device mappers that care about distinguishing these kinds of errors. Signed-off-by: Keith Busch <kbusch@kernel.org> Reviewed-by: Damien Le Moal <dlemoal@kernel.org> Reviewed-by: Christoph Hellwig <hch@lst.de> Reviewed-by: Chao Shi <coshi036@gmail.com>
|
Upstream branch: 79bd2dd |
A bio submitted to a zone block device that breaks the limits is invalid rather than an IO error. Fix up the return code to report it that way, as the previously used IOERR is considered a path failure. Signed-off-by: Keith Busch <kbusch@kernel.org> Reviewed-by: Damien Le Moal <dlemoal@kernel.org> Reviewed-by: Christoph Hellwig <hch@lst.de>
bio_check_eod() in submit_bio_noacct() validates that a bio does not extend beyond the partition's available sectors. This check runs before bio_queue_enter(), so it is not serialized against queue limit updates. A driver that freezes the queue, updates limits, changes the capacity, and unfreezes can race with a bio that passed the early check under the old capacity. Remove bio_check_eod() and replace it with a bounds check in __bio_split_to_limits(), which runs after the queue usage reference has been acquired. The check uses partition-aware arithmetic to validate both partition bounds and disk capacity in a single comparison that works correctly on the post-remap sector values. Signed-off-by: Keith Busch <kbusch@kernel.org>
The bio checks in submit_bio_noacct() compares queue limits to determine whether operations like discard, write zeroes, zone append, and atomic writes are supported and valid. These checks run before bio_queue_enter(), so they race against any driver that updates queue limits inside a freeze window. Move all limit-dependent operation validation from submit_bio_noacct() into __bio_split_to_limits(), which runs after the queue usage reference has been acquired. This ensures that all checks are properly serialized against limit updates. The non-limit checks (crypto, fault injection, partition remap, and flush flag handling) remain in submit_bio_noacct() as they do not depend on queue limits. Signed-off-by: Keith Busch <kbusch@kernel.org>
The nvme driver has long utilized a zero capacity to indicate the path isn't reachable, which creates a race condition with IO dispatch when paths are being detached on a live system: when the block layer rejects a bio early due to a capacity check failure, drivers with multipath support using the original bio have no interception point to redirect the bio to another path. We don't want to have to clone the bio just for this condition, so add a failed_bio callback to block_device_operations, called from bio_io_error. If the callback returns true, the driver has taken ownership of the bio and the error completion is skipped. Implement the callback for NVMe multipath. nvme_failed_bio redirects failing bios back to the multipath head device's requeue list for path re-selection, but only when all three conditions are met: - The bio came through the multipath head (REQ_NVME_MPATH) - The error is a path-related error (blk_path_error) - The path is no longer ready (!NVME_NS_READY) Signed-off-by: Keith Busch <kbusch@kernel.org>
9e9a5cd to
bf031f7
Compare
Pull request for series with
subject: block: validate bios against queue limits in the entered context
version: 1
url: https://patchwork.kernel.org/project/linux-block/list/?series=1097538