> From: Denis V. Lunev <[email protected]> > > qcow2_llseek_hole() starts at tgt->top and follows qcow2->lower, parsing > the metadata of each image, with nothing keeping the images alive. dm > core holds only the table SRCU around the call, which does not keep a > target message out. merge_backward complete unlinks the merged image, > waits in qcow2_inflight_ref_switch() for the qios holding refs and > destroys the image, so a seek already walking it goes on with a freed > struct qcow2, its md pages and its file. A SEEK_DATA scan of a large > sparse image keeps the walk running long enough to hit it. > > Hold a per-target rw_semaphore for read over the walk, and for write > while merge_backward complete unlinks and destroys the image. An > inflight ref held over the walk would also do, but every inflight ref > switch would then wait for the whole scan, including the one starting a > backward merge with the top image paused, which stalls guest I/O for as > long as the scan runs. > > merge_backward complete now waits for a running seek while it holds > ctl_mutex, so target messages and the presuspend of the device queue > behind it until the scan ends. > > Fixes: 412d5a4f7bf1 ("dm/dm-qcow2: add llseek_hole") > https://virtuozzo.atlassian.net/browse/VSTOR-153050 > Feature: dm-qcow2: block device over QCOW2 files driver > Reviewed-by: Andrey Zhadchenko <[email protected]> > Reviewed-by: Konstantin Khorenko <[email protected]> > Signed-off-by: Denis V. Lunev <[email protected]>
Sashiko has reviewed this patch and found no issues. It looks great! -- Sashiko AI review ยท https://sashiko.vzint.dev/#/patchset/[email protected]?part=3 _______________________________________________ Devel mailing list [email protected] https://lists.openvz.org/mailman/listinfo/devel
