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)
commitfc37e3dedee9026a4e745c7ab03ed293cb04eb60
tree493b844095b29b4d75650b4f177c235d13d36fff
parentcaf7ac7ef000097765b1c56404adb5e68b227977
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 <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