Skip to content

Commit 54ccd92

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 <[email protected]> Cc: [email protected] #6.11+ Signed-off-by: Jaehoon Kim <[email protected]> Signed-off-by: Stefan Haberland <[email protected]> Signed-off-by: Jens Axboe <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent 9582756 commit 54ccd92

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
@@ -3117,12 +3117,14 @@ static blk_status_t do_dasd_request(struct blk_mq_hw_ctx *hctx,
31173117
PTR_ERR(cqr) == -ENOMEM ||
31183118
PTR_ERR(cqr) == -EAGAIN) {
31193119
rc = BLK_STS_RESOURCE;
3120-
goto out;
3120+
} else if (PTR_ERR(cqr) == -EINVAL) {
3121+
rc = BLK_STS_INVAL;
3122+
} else {
3123+
DBF_DEV_EVENT(DBF_ERR, basedev,
3124+
"CCW creation failed (rc=%ld) on request %p",
3125+
PTR_ERR(cqr), req);
3126+
rc = BLK_STS_IOERR;
31213127
}
3122-
DBF_DEV_EVENT(DBF_ERR, basedev,
3123-
"CCW creation failed (rc=%ld) on request %p",
3124-
PTR_ERR(cqr), req);
3125-
rc = BLK_STS_IOERR;
31263128
goto out;
31273129
}
31283130
/*

0 commit comments

Comments
 (0)