Skip to content

Commit 9a3d248

Browse files
Jaehoon Kimkawasaki
authored andcommitted
s390/dasd: Return BLK_STS_INVAL for EINVAL from do_dasd_request
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]>
1 parent f04a84b commit 9a3d248

1 file changed

Lines changed: 7 additions & 5 deletions

File tree

drivers/s390/block/dasd.c

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3114,12 +3114,14 @@ static blk_status_t do_dasd_request(struct blk_mq_hw_ctx *hctx,
31143114
PTR_ERR(cqr) == -ENOMEM ||
31153115
PTR_ERR(cqr) == -EAGAIN) {
31163116
rc = BLK_STS_RESOURCE;
3117-
goto out;
3117+
} else if (PTR_ERR(cqr) == -EINVAL) {
3118+
rc = BLK_STS_INVAL;
3119+
} else {
3120+
DBF_DEV_EVENT(DBF_ERR, basedev,
3121+
"CCW creation failed (rc=%ld) on request %p",
3122+
PTR_ERR(cqr), req);
3123+
rc = BLK_STS_IOERR;
31183124
}
3119-
DBF_DEV_EVENT(DBF_ERR, basedev,
3120-
"CCW creation failed (rc=%ld) on request %p",
3121-
PTR_ERR(cqr), req);
3122-
rc = BLK_STS_IOERR;
31233125
goto out;
31243126
}
31253127
/*

0 commit comments

Comments
 (0)