backend: clear IO_U_F_FLIGHT flag in zero byte read path
authorShin'ichiro Kawasaki <shinichiro.kawasaki@wdc.com>
Fri, 21 Jul 2023 04:44:44 +0000 (13:44 +0900)
committerJens Axboe <axboe@kernel.dk>
Fri, 21 Jul 2023 14:02:55 +0000 (08:02 -0600)
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 <shinichiro.kawasaki@wdc.com>
Link: https://lore.kernel.org/r/20230721044444.749537-1-shinichiro.kawasaki@wdc.com
Signed-off-by: Jens Axboe <axboe@kernel.dk>
backend.c

index b06a11a562d9bd96cbad5dc34a232a0d15150d67..cb5844dba2391f0f9c14b20940f789511737a023 100644 (file)
--- 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;
                        }