iolog: fix io_piece leak on overlapping in-flight writes

When an in-flight io_piece is evicted from the RB tree due to an
overlapping write in log_io_piece(), the entry cannot be freed
immediately. However, the IP_F_ONRB flag was not cleared on eviction.
On IO completion, the entry still appeared to belong to the tree, so
it was never freed.

Clear IP_F_ONRB when evicting an in-flight entry from the tree. On IO
completion, detect the orphaned io_piece (neither IP_F_ONRB nor
IP_F_ONLIST set) and free it.

This leak only occurs with norandommap or softrandommap where
fio_offset_overlap_risk() is true, causing io_pieces to be stored in
the RB tree with overlap detection.

Signed-off-by: Yehor Malikov <Yehor.Malikov@solidigm.com>
2 files changed