[Devel] [PATCH hci-8.2 v2 3/8] dm-qcow2: fix queue_work() after the target or image is freed
no-reply at sashiko.virtuozzo.com
no-reply at sashiko.virtuozzo.com
Mon Nov 23 18:42:01 MSK 2026
> From: Denis V. Lunev <den at openvz.org>
>
> qcow2_dispatch_qios(), qcow2_queue_resubmit() and
> md_page_write_complete() add a qio to a worker list under
> deferred_lock, drop the lock and only then queue the worker. Called
> from an image I/O completion, they let the worker take the qio in that
> gap and end it, and suspend and a dmsetup remove can then destroy
> tgt->wq before queue_work() runs on it. A backward merge has the same
> gap without a remove: qcow2_merge_backward_complete() frees the merged
> image, and with it the qcow2->worker that the late queue_work() uses.
>
> Queue the worker before dropping the lock, through a helper that
> asserts deferred_lock is held. The worker takes its lists under the
> same lock, so the qio, and the reference that keeps the target, outlive
> the queue_work() call. Do the same in qcow2_submit_embedded_qio(), where
> only the pattern changes: its qios belong to DM requests, and its timer
> and merge callers are stopped before the target is destroyed.
>
> https://virtuozzo.atlassian.net/browse/VSTOR-156036
>
> Fixes: 222b6f1291c1 ("dm-qcow2: Introduce driver to create block devices over QCOW2 files")
> Feature: dm-qcow2: block device over QCOW2 files driver
> Signed-off-by: Denis V. Lunev <den at openvz.org>
Sashiko has reviewed this patch and found no issues.
Carry the trailer below into the next revision and Sashiko will not review this patch again.
Reviewed-by: Sashiko <no-reply at sashiko.virtuozzo.com>
--
Sashiko AI review · https://sashiko.vzint.dev/#/patchset/20261123153640.128227-1-den@openvz.org?part=3
More information about the Devel
mailing list