[Devel] [PATCH hci-8.1 3/4] dm-ploop: wait for the ploop_allocator() thread before changing deltas[]

Konstantin Khorenko khorenko at virtuozzo.com
Wed Nov 4 20:14:19 MSK 2026


I won't apply this version, please send v2 with the changes below.

On Tue, 03 Nov 2026 09:36:41 +0100, Denis V. Lunev wrote:
>  static void ploop_postsuspend(struct dm_target *ti)
>  {
> +	struct ploop *ploop = ti->private;
> +
> +	wait_event(ploop->dispatcher_wq_prealloc,
> +		   ploop_no_pending_prealloc(ploop));
>  	ploop_set_suspended(ti, true);
>  }

Item 3 of the cover letter reply, code: also wait for
ploop_no_pending_prealloc() in ploop_flip_upper_deltas() before
process_flip_upper_deltas(), keep this wait.

Why: a resize on a dm suspended device re-arms the allocator after this
wait. ploop_resize() does not check ->suspended, and the grow allocates
through ploop_prepare_reloc_index_wb() and ploop_allocate_cluster(),
which requests a preallocation and does not wait when the cluster fits.
So suspend, set_noresume 1, resize, flip_upper_deltas still lets the
flip swap the slots under a running allocator, which is the truncation
this patch fixes.

> - merge and notify_merged_backward move the top delta one slot down and
>   zero the old slot. The allocator then reads a zero file_size from it

Item 3 of the cover letter reply, message: "merge and notify_merged".

Why: notify_delta_merged() renumbers the slots above @level for forward
as well. The code already covers it through
ploop_suspend_submitting_pios(), only the message is narrower than the
fix.

-- 
Konstantin Khorenko,
Virtuozzo Linux Kernel Team



More information about the Devel mailing list