[PATCH RFC 1/5] blk-mq: fix status for unaligned bio

Keith Busch kbusch at meta.com
Tue May 19 10:23:22 PDT 2026


From: Keith Busch <kbusch at kernel.org>

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 at kernel.org>
---
 block/blk-mq.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/block/blk-mq.c b/block/blk-mq.c
index d0c37daf568f2..881183345a85c 100644
--- a/block/blk-mq.c
+++ b/block/blk-mq.c
@@ -3182,7 +3182,8 @@ void blk_mq_submit_bio(struct bio *bio)
 	 * have to be done with queue usage counter held.
 	 */
 	if (unlikely(bio_unaligned(bio, q))) {
-		bio_io_error(bio);
+		bio->bi_status = BLK_STS_INVAL;
+		bio_endio(bio);
 		goto queue_exit;
 	}
 
-- 
2.53.0-Meta




More information about the Linux-nvme mailing list