On Fri, Nov 20, 2026, [email protected] wrote: > While __dm_bufio_prefetch() drops dm_bufio_lock(c) across submit_io() > and dm_bufio_release(), b remains in c->cache with hold_count == 1. A > concurrent dm_bufio_client_reset() skips b in __get_unclaimed_buffer(), > triggers the leak WARN_ONs in warn_leak() and drop_buffers(), and under > CONFIG_DM_DEBUG_BLOCK_STACK_TRACING zeroes b->hold_count and frees b > while CPU0 still holds it.
Confirmed -- dm_bufio_lock is indeed released before submit_io() and dm_bufio_release(), so the hold_count == 1 window is real. My earlier analysis that the release happened under the lock was wrong. > Also, contrary to the documentation note in verity.rst, v->bufio is > bound to v->hash_dev->bdev rather than the top-level DM device, so > calling prefetch_hash while suspended submits read bios directly to > the underlying hash device instead of queueing them until resume. Also correct; the documentation claim was wrong. v4 rejects prefetch_hash and drop_hash with -EBUSY while the device is suspended. No further serialization is needed: __dm_suspend() sets the suspended flag before the final synchronize_srcu() that precedes ->postsuspend, and the message handler runs inside the SRCU read section, so a message that passed the check is drained before the reset (including the hold_count == 1 window), and one that arrives after the barrier sees the flag. I could not reproduce the WARN on a VM even with a debug delay widening the window to 100us per block: synchronize_srcu() drains in-flight messages before postsuspend, leaving only a microsecond-scale gap that I could not hit. The scenario is correct on paper; the -EBUSY check removes it regardless. Thanks for the review, Yongpeng
