[Devel] [PATCH hci-8.2 v8 0/9] dm-ploop: give back unused tail of top delta on suspend

Alexander Ivanov alexander.ivanov at virtuozzo.com
Wed Nov 18 18:07:07 MSK 2026


On 11/18/26 14:41, Konstantin Khorenko wrote:
> I won't apply this version, please send v9 with the changes below.
>
> All eight v7 items are done in the code, thanks. What is left:
>
> 1. 8/9: prealloc_stopped drops every preallocation request for the
>     whole time the device is suspended, so a "resize" (or a merge) of
>     a suspended device that needs a cluster past top->file_size now
>     fails with -EIO after the "Prealloc failed" retries; before it grew
>     the file. Either fence only when the postsuspend wait was skipped
>     (standby), or refuse resize and merge on a suspended device with
>     -EBUSY, and say which in the message. ploop_flip_upper_deltas()
>     still says "A resize of the suspended device may have restarted
>     the allocator".
There is no persistent fence in the new version: ploop_stop_prealloc()
zeroes prealloc_size once in postsuspend and once at the end of a
message to a suspended device, and waits for the operation in flight
unless in standby. A resize or merge of a suspended device still gets
its preallocation while it runs, so it doesn't hit "Prealloc failed" / -EIO.
Only the requests left after it ends are dropped.

Rewrote the comment to "In standby, postsuspend may leave a prealloc in 
flight".
> 2. 8/9: the preresume wait for inflight_md runs before ctl_rwsem, so a
>     resize issued during the resume can leave it at 1 and the reload is
>     skipped with no trace; at least log it.
Agreed, a message can slip in between the wait and down_write(). Fixed
by repeating the wait under ctl_rwsem. The first wait stays outside the
lock so a stuck writeback doesn't block status and messages.
> 3. Messages: 6/9 says "calls wake_up()" where the replaced code calls
>     wake_up_interruptible(), and does not say that wake_up_locked() is
>     what wakes the new uninterruptible wait in ploop_destroy(); split
>     the "Request preallocation..." paragraph of 8/9 (eight sentences)
>     and give the two __dm_destroy() sentences of 9/9 their own
>     paragraph; 9/9 logs an expected -EBUSY skip on dirty md as an
>     error.
- 6/9: fixed to wake_up_interruptible(), and the message now
   says wake_up_locked() is what wakes the uninterruptible wait in
   ploop_destroy().
- 8/9: split the preallocation paragraph into three.
- 9/9: moved the __dm_destroy() sentences into their own paragraph.
   Moved the md_pages_are_clean check into ploop_truncate_unused_tail(),
   so dirty md now skips the truncation silently instead of logging an 
error.
> 4. Cover letter: the deploy order against the ploop PR is still
>     missing; 3/9 fixes the is_raw order, not header validation; the
>     wait left as is is in ploop_suspend_submitting_pios(), not in
>     ploop_resize().
Fixed 2 and 3 in the cover letter. There is no deploy order to state:
the userspace PR is already merged. The cover letter now says
that it dropped the manual tail trimming, so the tail is not given
back until this series is applied.
> On Wed, 18 Nov 2026 14:10:23 +0100, Alexander Ivanov wrote:
>> - Patch 8 (was 9):
>>    - keep the waits for preallocation and BAT writeback in postsuspend
>>      uninterruptible and skip both in standby; drop
>>      ploop_wait_prealloc();
>>    - drop pending prealloc requests while suspended (prealloc_stopped),
>>      so after a skipped wait the old allocator doesn't resize the top
>>      delta under a ploop of a reloaded table;
> 1. Only work that can run after the table swap needs fencing, and the
> standby case is the only one where the wait is skipped. A message on
> the old table finishes before the swap (__bind() calls dm_sync_table()),
> so a resize of the suspended device does not race with the new table.
dm_sync_table() waits for the message, but not for the ploop_allocator()
thread it kicks: a resize relocates clusters via 
ploop_allocate_cluster(), and
the allocator may keep preallocating after the swap, standby or not,
hence ploop_stop_prealloc() at the end of a message to the suspended
device. The BAT write of a resize is synchronous indeed, I reworded the
message: only its inflight_md reference may be dropped late, which
matters for resume of the same table.
> Thanks.
>


More information about the Devel mailing list