From fc37e3dedee9026a4e745c7ab03ed293cb04eb60 Mon Sep 17 00:00:00 2001 From: Shin'ichiro Kawasaki Date: Fri, 21 Jul 2023 13:44:44 +0900 Subject: [PATCH] backend: clear IO_U_F_FLIGHT flag in zero byte read path When read io_u completes with zero byte read, it sets EIO as the error and put the io_u. However, it does not clear the IO_U_F_FLIGHT flag. When fio runs with --ignore_error=EIO option, the io_u with the flag is reused for next I/O and causes an assertion failure: fio: ioengines.c:335: td_io_queue: Assertion `(io_u->flags & IO_U_F_FLIGHT) == 0' failed. The failure is observed with blktests test case block/011 which runs fio with the --ignore_error=EIO option [1]. [1] https://github.com/osandov/blktests/issues/29 Fix this by calling clear_io_u() instead of put_io_u() in the zero byte read path. clear_io_u() clears the IO_U_F_FLIGHT flag then calls put_io_u(). Signed-off-by: Shin'ichiro Kawasaki Link: https://lore.kernel.org/r/20230721044444.749537-1-shinichiro.kawasaki@wdc.com Signed-off-by: Jens Axboe --- backend.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/backend.c b/backend.c index b06a11a5..cb5844db 100644 --- a/backend.c +++ b/backend.c @@ -466,7 +466,7 @@ int io_queue_event(struct thread_data *td, struct io_u *io_u, int *ret, if (!from_verify) unlog_io_piece(td, io_u); td_verror(td, EIO, "full resid"); - put_io_u(td, io_u); + clear_io_u(td, io_u); break; } -- 2.25.1