[Devel] [PATCH hci-8.2 2/9] dm-qcow2: free md pages after an RCU grace period

no-reply at sashiko.virtuozzo.com no-reply at sashiko.virtuozzo.com
Tue Dec 1 03:06:41 MSK 2026


> From: Denis V. Lunev <den at openvz.org>
> 
> Metadata lookups are going to walk the md_pages tree without
> md_pages_lock. Such a walk may still be on a node that is erased and
> freed at the same time, e.g. by do_md_page_read_complete() on a failed
> read.
> 
> Free md pages from an RCU callback and link new nodes with
> rb_link_node_rcu(), so a lookup under rcu_read_lock() never touches
> freed memory. rb_find_rcu() tolerates concurrent rotations with a
> false negative at worst. The rotations of rb_insert_color() may store
> a pointer to the new node again, so order its initialization before
> them too. Wait for pending callbacks with rcu_barrier() on module
> exit.
> 
> qcow2_md_page_renumber() erases and relinks a node in place without a
> grace period. A walker on it can only miss, and it only moves R1
> pages, which lockless lookups never accept.
> 
> https://virtuozzo.atlassian.net/browse/VSTOR-95494
> 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/20261125012525.681662-1-den@openvz.org?part=2




More information about the Devel mailing list