Re: [PATCH] block: cleanup and fix batch completion adding conditions

Ondrej Kozina
2025-02-28T11:59:10Z

Hi Jens,

this patch introduced regression to locked SED OPAL2 devices. The locked
region no longer returns -EIO upon IO. On read the caller receives block
of zeroes, on write it does not report any error either. In both cases,
previous to this patch, the caller would get IO error (expected) with
locked device.

It was discovered by cryptsetup testsuite specifically
https://gitlab.com/cryptsetup/cryptsetup/-/blob/main/tests/compat-test-opal

I've attached a simple patch that changes the ioerror condition and it
fixed the problem with SED OPAL2 devices for me.

#regzbot introduced: 1f47ed294a2bd577d5ae43e6e28e1c9a3be4a833

With kind regards
O.

------

diff --git a/include/linux/blk-mq.h b/include/linux/blk-mq.h
index fa2a76cc2f73..b891ed113306 100644
--- a/include/linux/blk-mq.h
+++ b/include/linux/blk-mq.h
@@ -874,7 +874,7 @@ static inline bool blk_mq_add_to_batch(struct
request *req,
if (!blk_rq_is_passthrough(req)) {
if (req->end_io)
return false;
- if (ioerror < 0)
+ if (ioerror)
return false;
}