Skip to content

Commit d38c0ca

Browse files
committed
io_u: check non-fatal error with IO_U_F_DEVICE_ERROR
IO_U_F_DEVICE_ERROR has been introduced in Commit ebe67b6 ("io_uring: Add IO_U_F_DEVICE_ERROR to identify error types") to parse two different types of errors can happen: (1) device error(e.g., NVMe-specific error status code) and (2) system error(e.g., EINVAL). `--ignore_error=` option let user mask expected situation, but if user wants to mask system error rather than device error, no way to represent the system error except for such as -EINVAL. Even if user put -EINVAL to the option, it will be checked as a positive value since @io_u->error will be set with abs() in io_uring_cmd ioengine. This patch flips the given @io_u->error positive value to a negative value if the given @io_u->flags represents system error by IO_U_F_DEVICE_ERROR. Signed-off-by: Minwoo Im <[email protected]>
1 parent 90c3006 commit d38c0ca

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

io_u.c

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2196,7 +2196,16 @@ static void io_completed(struct thread_data *td, struct io_u **io_u_ptr,
21962196
}
21972197
} else if (io_u->error) {
21982198
error:
2199-
icd->error = io_u->error;
2199+
if (io_u->flags & IO_U_F_DEVICE_ERROR)
2200+
icd->error = io_u->error;
2201+
else {
2202+
/*
2203+
* If @io_u has system error(non-device erorr), it must
2204+
* have been negative value.
2205+
*/
2206+
icd->error = -io_u->error;
2207+
}
2208+
22002209
io_u_log_error(td, io_u);
22012210
}
22022211
if (icd->error) {

0 commit comments

Comments
 (0)