From: no-reply@sashiko.virtuozzo.com
To: Alexander Ivanov <alexander.ivanov@virtuozzo.com>,
andrey.zhadchenko@virtuozzo.com
Cc: devel@openvz.org
Subject: Re: [Devel] [PATCH hci-8.2 v9 8/9] dm-ploop: reload metadata on resume
Date: Thu, 19 Nov 2026 11:52:21 +0000 [thread overview]
Message-ID: <010701a1f3a69014-1a504b26-8af2-4ebd-8c11-5da13f14d6af-000000@eu-central-1.amazonses.com> (raw)
In-Reply-To: <20261119113446.3579457-9-alexander.ivanov@virtuozzo.com>
Thank you for your contribution! Sashiko AI review found 3 potential
issues to consider:
- [Medium] dm-ploop: preresume silently skips metadata reload while a
message prealloc is in flight
- [Low] dm-ploop: standby skip in ploop_wait_prealloc() is checked once,
so late standby still hangs
- [Low] dm-ploop: ploop_preresume() waits for inflight_md under
ctl_rwsem
--
commit 168cc5688f3ec08094520c1dcd5ae48875d3f9d2
Author: Alexander Ivanov <alexander.ivanov@virtuozzo.com>
dm-ploop: reload metadata on resume
This reloads the top delta header, the BAT of every delta and the delta file sizes in ploop_preresume(). It also reworks the postsuspend and message waits for BAT writeback and preallocation, and tracks standby per ploop.
> diff --git a/drivers/md/dm-ploop-map.c b/drivers/md/dm-ploop-map.c
> --- a/drivers/md/dm-ploop-map.c
> +++ b/drivers/md/dm-ploop-map.c
[ ... ]
> +void ploop_wait_prealloc(struct ploop *ploop)
> +{
> + if (!READ_ONCE(ploop->standby))
> + wait_event(ploop->dispatcher_wq_prealloc,
> + ploop_no_pending_prealloc(ploop));
> +}
> +
> +void ploop_stop_prealloc(struct ploop *ploop)
> +{
> + ploop_drop_prealloc(ploop);
> + ploop_wait_prealloc(ploop);
> +}
[Severity: Low]
Does this skip only help when standby is already set on entry? The flag is tested once, before sleeping, and is not part of the wait_event() condition.
ploop_check_standby_mode() sets the flag with WRITE_ONCE(ploop->standby, true) but never wakes dispatcher_wq_prealloc. If standby is set after the waiter has gone to sleep and the allocator is stuck in truncate on a dead file, the uninterruptible wait in ploop_postsuspend() (or in ploop_message()) never ends. dm_replace() then cannot suspend the device to recover it, which is the case the commit message says this is meant to avoid.
Would it work to put the standby flag into the wait condition and call wake_up() on dispatcher_wq_prealloc when standby is set?
> diff --git a/drivers/md/dm-ploop-target.c b/drivers/md/dm-ploop-target.c
> --- a/drivers/md/dm-ploop-target.c
> +++ b/drivers/md/dm-ploop-target.c
[ ... ]
> static int ploop_preresume(struct dm_target *ti)
> {
> struct ploop *ploop = ti->private;
> + unsigned int noio_flags;
> + bool reload = false;
> int ret = 0;
>
> + /* A resize of the suspended device may drop inflight_md late */
> + if (!ploop_is_standby(ploop))
> + wait_event(ploop->inflight_md_wq,
> + !atomic_read(&ploop->inflight_md));
> +
> down_write(&ploop->ctl_rwsem);
> + /* A message may have slipped in before the lock */
> + if (!ploop_is_standby(ploop))
> + wait_event(ploop->inflight_md_wq,
> + !atomic_read(&ploop->inflight_md));
[Severity: Low]
The commit message says waits are done outside ctl_rwsem so that a stuck writeback doesn't block status and messages. Doesn't this second wait break that for the window it covers? It is an unbounded, uninterruptible wait_event() with ctl_rwsem held for write, and standby is not rechecked while it sleeps. If BAT writeback started by a message in that gap never completes, status and other messages block behind ctl_rwsem as well as the resume.
> if (ploop->noresume) {
> ret = -EAGAIN;
> + } else if (!ploop_is_standby(ploop) &&
> + ploop_no_pending_prealloc(ploop)) {
> + reload = true;
[Severity: Medium]
Can this skip the reload silently and still resume the device? When a prealloc is pending, the branch is not taken, ret stays 0 and suspended is cleared, so the new ploop runs with the BAT, holes_bitmap and file sizes read in ploop_ctr(). That is the stale-metadata state this patch is meant to remove.
A pending prealloc is reachable from ploop_message(), which drops ctl_rwsem before waiting for the in-flight prealloc. target_message() does not take md->suspend_lock, so it can overlap with dm_resume():
CPU0 (message, e.g. resize) CPU1 (resume ioctl)
ploop_message()
ploop_drop_prealloc()
up_write(&ctl_rwsem)
ploop_preresume()
down_write(&ctl_rwsem)
ploop_no_pending_prealloc() == 0
reload skipped, suspended = false
<-- stale metadata
ploop_wait_prealloc()
The same silent skip happens after a standby postsuspend that did not wait. ploop_reload_metadata() also returns 0 without logging when the md pages are not clean. Could preresume wait for the prealloc to finish, or fail the resume (for example with -EAGAIN) instead of succeeding without a reload?
--
Sashiko AI review · https://sashiko.vzint.dev/#/patchset/20261119113446.3579457-1-alexander.ivanov@virtuozzo.com?part=8
_______________________________________________
Devel mailing list
Devel@openvz.org
https://lists.openvz.org/mailman/listinfo/devel
next prev parent reply other threads:[~2026-11-19 11:53 UTC|newest]
Thread overview: 29+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-19 11:34 [Devel] [PATCH hci-8.2 v9 0/9] dm-ploop: give back unused tail of top delta on suspend Alexander Ivanov
2026-11-19 11:34 ` [Devel] [PATCH hci-8.2 v9 1/9] dm-ploop: reject a delta header whose BAT does not cover the target Alexander Ivanov
2026-11-19 11:39 ` no-reply
2026-11-19 11:34 ` [Devel] [PATCH hci-8.2 v9 2/9] dm-ploop: reject empty deltas Alexander Ivanov
2026-11-19 11:39 ` no-reply
2026-11-19 11:34 ` [Devel] [PATCH hci-8.2 v9 3/9] dm-ploop: set delta is_raw before applying its mappings Alexander Ivanov
2026-11-19 11:39 ` no-reply
2026-11-19 11:34 ` [Devel] [PATCH hci-8.2 v9 4/9] dm-ploop: factor out ploop_read_delta() from ploop_add_delta() Alexander Ivanov
2026-11-19 11:40 ` no-reply
2026-11-19 12:11 ` Konstantin Khorenko
2026-11-19 14:31 ` Alexander Ivanov
2026-11-19 14:38 ` Alexander Ivanov
2026-11-19 11:34 ` [Devel] [PATCH hci-8.2 v9 5/9] dm-ploop: take bat_lock around md page lookup in ploop_llseek_hole() Alexander Ivanov
2026-11-19 11:42 ` no-reply
2026-11-19 11:34 ` [Devel] [PATCH hci-8.2 v9 6/9] dm-ploop: fix use-after-free on the last inflight_md decrement Alexander Ivanov
2026-11-19 11:47 ` no-reply
2026-11-19 11:34 ` [Devel] [PATCH hci-8.2 v9 7/9] dm-ploop: fix flip_upper_deltas racing with resume Alexander Ivanov
2026-11-19 11:43 ` no-reply
2026-11-19 11:34 ` [Devel] [PATCH hci-8.2 v9 8/9] dm-ploop: reload metadata on resume Alexander Ivanov
2026-11-19 11:52 ` no-reply [this message]
2026-11-19 14:16 ` Alexander Ivanov
2026-11-19 12:11 ` Konstantin Khorenko
2026-11-19 13:51 ` Alexander Ivanov
2026-11-19 11:34 ` [Devel] [PATCH hci-8.2 v9 9/9] dm-ploop: truncate unused tail of top delta on suspend Alexander Ivanov
2026-11-19 11:52 ` no-reply
2026-11-19 14:22 ` Alexander Ivanov
2026-11-19 12:11 ` Konstantin Khorenko
2026-11-19 14:19 ` Alexander Ivanov
2026-11-19 12:11 ` [Devel] [PATCH hci-8.2 v9 0/9] dm-ploop: give back " Konstantin Khorenko
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=010701a1f3a69014-1a504b26-8af2-4ebd-8c11-5da13f14d6af-000000@eu-central-1.amazonses.com \
--to=no-reply@sashiko.virtuozzo.com \
--cc=alexander.ivanov@virtuozzo.com \
--cc=andrey.zhadchenko@virtuozzo.com \
--cc=devel@openvz.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox