Skip to content

Commit f84f57b

Browse files
Jaehoon Kimgregkh
authored andcommitted
s390/dasd: Return BLK_STS_INVAL for EINVAL from do_dasd_request
commit 8f4ed0c upstream. Currently, if CCW request creation fails with -EINVAL, the DASD driver returns BLK_STS_IOERR to the block layer. This can happen, for example, when a user-space application such as QEMU passes a misaligned buffer, but the original cause of the error is masked as a generic I/O error. This patch changes the behavior so that -EINVAL is returned as BLK_STS_INVAL, allowing user space to properly detect alignment issues instead of interpreting them as I/O errors. Reviewed-by: Stefan Haberland <sth@linux.ibm.com> Cc: stable@vger.kernel.org #6.11+ Signed-off-by: Jaehoon Kim <jhkim@linux.ibm.com> Signed-off-by: Stefan Haberland <sth@linux.ibm.com> Signed-off-by: Jens Axboe <axboe@kernel.dk> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent 4e6f98b commit f84f57b

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

drivers/s390/block/dasd.c

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3119,12 +3119,14 @@ static blk_status_t do_dasd_request(struct blk_mq_hw_ctx *hctx,
31193119
PTR_ERR(cqr) == -ENOMEM ||
31203120
PTR_ERR(cqr) == -EAGAIN) {
31213121
rc = BLK_STS_RESOURCE;
3122-
goto out;
3122+
} else if (PTR_ERR(cqr) == -EINVAL) {
3123+
rc = BLK_STS_INVAL;
3124+
} else {
3125+
DBF_DEV_EVENT(DBF_ERR, basedev,
3126+
"CCW creation failed (rc=%ld) on request %p",
3127+
PTR_ERR(cqr), req);
3128+
rc = BLK_STS_IOERR;
31233129
}
3124-
DBF_DEV_EVENT(DBF_ERR, basedev,
3125-
"CCW creation failed (rc=%ld) on request %p",
3126-
PTR_ERR(cqr), req);
3127-
rc = BLK_STS_IOERR;
31283130
goto out;
31293131
}
31303132
/*

0 commit comments

Comments
 (0)