zbd: Fix unexpected job termination by open zone search failure
authorShin'ichiro Kawasaki <shinichiro.kawasaki@wdc.com>
Thu, 30 Sep 2021 00:02:36 +0000 (09:02 +0900)
committerJens Axboe <axboe@kernel.dk>
Thu, 30 Sep 2021 16:05:23 +0000 (10:05 -0600)
commit0f77c977ab44a10d69268546a849376efc327d47
treedd36ead146151ceb9c581fc3185853bc5d676369
parent203e4c2624493c0db8c69c9ad830090c5b79be67
zbd: Fix unexpected job termination by open zone search failure

Test case #46 in t/zbd/test-zbd-support fails when it is repeated
hundreds of times on null_blk zoned devices. The test case uses libaio
IO engine to run 8 random write jobs on 4 sequential write required
zones. When all of the 4 zones get almost full but still open for
in-flight writes, the helper function zbd_convert_to_open_zone() fails
to get an opened zone for next write. This results in unexpected job
termination.

To avoid the unexpected job termination, retry the steps in
zbd_convert_to_open_zone(). Before retry, call io_u_quiesce() to ensure
that the in-flight writes get completed.

To prevent infinite loop by the retry, retry only when any IOs are
in-flight or in-flight IOs get completed. To check in-flight IO count of
all jobs, add a new helper function any_io_in_flight().

Signed-off-by: Shin'ichiro Kawasaki <shinichiro.kawasaki@wdc.com>
Reviewed-by: Niklas Cassel <niklas.cassel@wdc.com>
Reviewed-by: Dmitry Fomichev <dmitry.fomichev@wdc.com>
Link: https://lore.kernel.org/r/20210930000236.4116945-1-shinichiro.kawasaki@wdc.com
Signed-off-by: Jens Axboe <axboe@kernel.dk>
zbd.c