ioengines.c:346: td_io_queue: Assertion `res == 0' failed
authorHorshack <horshack@live.com>
Sat, 18 Feb 2023 18:07:09 +0000 (13:07 -0500)
committerHorshack <horshack@live.com>
Sat, 18 Feb 2023 18:28:18 +0000 (13:28 -0500)
commitd5a47449ce79001ba233fe6d0499627d0438cb69
treefeae1375b0bace1b4d4c8992fccd1d00d67e7702
parentded6cce8274ccf6f3820fb19ab46fd6d2aed0311
ioengines.c:346: td_io_queue: Assertion `res == 0' failed

Assertion in ioengines.c::td_io_queue() fails for pthread_mutex_unlock()
on overlap_check mutex when serialize_overlap=1, io_submit_mode=offload,
and verify=<any> are used together.

backend.c::fio_io_sync() invokes td_io_queue(), which expects the caller
to have ownership of the overlap_check mutex when serialize_overlap
and offloading are configured, as part of the overlap-check interlock
with IO_U_F_FLIGHT. The mutex is not acquired for this path because it's
not an I/O requiring an overlap check.

The fix is to refine the conditional that triggers td_io_queue() to
release the overlap_check mutex. Rather than using broad config options,
the conditional now uses a new io_u flag named IO_U_F_OVERLAP_LOCK, which
is only set for the offload worker thread path that acquires the mutex.

Link: https://github.com/axboe/fio/issues/1520
Signed-off-by: Adam Horshack (horshack@live.com)
io_u.h
ioengines.c
rate-submit.c