From: Fiona Ebner <f.ebner@proxmox.com>
To: "Proxmox VE development discussion" <pve-devel@lists.proxmox.com>,
"Fabian Grünbichler" <f.gruenbichler@proxmox.com>
Subject: Re: [pve-devel] [PATCH v2 storage] lvm plugin: fix locking for rollback when using CLI
Date: Thu, 20 Nov 2025 14:35:17 +0100 [thread overview]
Message-ID: <b39fbaae-8e34-4cfe-85bf-fe529dd857d1@proxmox.com> (raw)
In-Reply-To: <1763644497.6m8gy24914.astroid@yuna.none>
Am 20.11.25 um 2:21 PM schrieb Fabian Grünbichler:
> On November 20, 2025 11:17 am, Fiona Ebner wrote:
>> @@ -1141,14 +1135,29 @@ my sub volume_snapshot_rollback_locked {
>> sub volume_snapshot_rollback {
>> my ($class, $scfg, $storeid, $volname, $snap) = @_;
>>
>> - return $class->cluster_lock_storage(
>> - $storeid,
>> - $scfg->{shared},
>> - undef,
>> - sub {
>> - return volume_snapshot_rollback_locked($class, $scfg, $storeid, $volname, $snap);
>> - },
>> - );
>> + my $cleanup_worker;
>> +
>> + eval {
>> + $class->cluster_lock_storage(
>> + $storeid,
>> + $scfg->{shared},
>> + undef,
>> + sub {
>> + volume_snapshot_rollback_locked(
>> + $class, $scfg, $storeid, $volname, $snap, \$cleanup_worker,
>> + );
>> + },
>> + );
>> + };
>> + my $err = $@;
>> +
>> + # Spawn outside of the locked section, because with 'saferemove', the cleanup worker also needs
>> + # to obtain the lock, and in CLI context, it will be awaited synchronously, see fork_worker().
>> + fork_cleanup_worker($cleanup_worker);
>
> I mean, this just worked because the forked cleanup sub waited long
> enough by chance for the lock/before acquiring the lock to allow the
> parent to release it in the non-CLI case, right? i.e., it was still
> wrong, because volume_snapshot_rollback_locked might have done more work
> after forking the cleanup worker while still holding the lock..
Yes, that is true.
> all the other code paths here have this pattern:
>
> my $cleanup_worker = eval { lock and do something };
> fork_cleanup_worker($cleanup_worker)
>
> which is exactly what this patch switches to, so consider this
>
> Reviewed-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
Thanks for the review!
_______________________________________________
pve-devel mailing list
pve-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel
next prev parent reply other threads:[~2025-11-20 13:35 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-11-20 10:17 Fiona Ebner
2025-11-20 13:21 ` Fabian Grünbichler
2025-11-20 13:35 ` Fiona Ebner [this message]
2025-11-20 14:06 ` [pve-devel] applied: " Thomas Lamprecht
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=b39fbaae-8e34-4cfe-85bf-fe529dd857d1@proxmox.com \
--to=f.ebner@proxmox.com \
--cc=f.gruenbichler@proxmox.com \
--cc=pve-devel@lists.proxmox.com \
/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