From: Fiona Ebner <f.ebner@proxmox.com>
To: Andrei Perepiolkin <andrei.perepiolkin@open-e.com>
Cc: Proxmox VE development discussion <pve-devel@lists.proxmox.com>
Subject: Re: [pve-devel] [RFC storage] lvm plugin: fix locking for rollback when using CLI
Date: Thu, 20 Nov 2025 10:50:11 +0100 [thread overview]
Message-ID: <d0efc11d-7c5d-44fc-bc79-1683cf92f7d1@proxmox.com> (raw)
In-Reply-To: <3bfa9f25-9a9d-4278-9cb1-77df02db2f40@open-e.com>
Hi Andrei,
Am 20.11.25 um 9:03 AM schrieb Andrei Perepiolkin:
> Hi Fiona,
>
> Regarding lock problem that you have mentioned.
> Can it be related to series of calls:
>
> volume_snapshot_rollback https://github.com/proxmox/pve-storage/blob/
> a52a1ef526e289d54a5bf44c7467dd4ee49aecab/src/PVE/Storage/
> LVMPlugin.pm#L1141C1-L1152C2
> |
> volume_snapshot_rollback_locked https://github.com/proxmox/pve-storage/
> blob/a52a1ef526e289d54a5bf44c7467dd4ee49aecab/src/PVE/Storage/
> LVMPlugin.pm#L1119C1-L1126C98
> |
> free_snap_image https://github.com/proxmox/pve-storage/blob/
> a52a1ef526e289d54a5bf44c7467dd4ee49aecab/src/PVE/Storage/
> LVMPlugin.pm#L763C1-L768C2
> |
> free_lvm_volumes https://github.com/proxmox/pve-storage/blob/
> a52a1ef526e289d54a5bf44c7467dd4ee49aecab/src/PVE/Storage/
> LVMPlugin.pm#L374C1-L382C15
>
> Best regards,
> Andrei
>
yes, it is those calls. That's why the patch moves the spawning of the
cleanup worker outside of the locked rollback section. The open question
was why it happens via CLI, but not via UI. I didn't have the time to
look into the reason yesterday, but looking at fork_worker() in
RESTEnvironment.pm is pretty telling, which has a note:
# NOTE: we simulate running in foreground if ($self->{type} eq 'cli')
so while it does fork() and spawn a second task, it waits for that
synchronously and therefore does not drop the lock.
> On 11/19/25 12:22, Fiona Ebner wrote:
>> @@ -1141,14 +1135,22 @@ my sub volume_snapshot_rollback_locked {
>> sub volume_snapshot_rollback {
>> my ($class, $scfg, $storeid, $volname, $snap) = @_;
>> - return $class->cluster_lock_storage(
>> + my $cleanup_worker;
>> +
>> + $class->cluster_lock_storage(
>> $storeid,
>> $scfg->{shared},
>> undef,
>> sub {
>> - return volume_snapshot_rollback_locked($class, $scfg,
>> $storeid, $volname, $snap);
>> + volume_snapshot_rollback_locked(
>> + $class, $scfg, $storeid, $volname, $snap, \
>> $cleanup_worker,
>> + );
>> },
>> );
I forgot to put an eval around here to make sure we spawn the cleanup
worker in the error case too. I'll send a v2 with that and more context
in the commit message
>> +
>> + fork_cleanup_worker($cleanup_worker);
>> +
>> + return;
>> }
>> sub volume_snapshot_delete {
>
Best Regards,
Fiona
_______________________________________________
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 9:50 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-11-19 17:22 Fiona Ebner
[not found] ` <3bfa9f25-9a9d-4278-9cb1-77df02db2f40@open-e.com>
2025-11-20 9:50 ` Fiona Ebner [this message]
2025-11-20 10:19 ` [pve-devel] superseded: " Fiona Ebner
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=d0efc11d-7c5d-44fc-bc79-1683cf92f7d1@proxmox.com \
--to=f.ebner@proxmox.com \
--cc=andrei.perepiolkin@open-e.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.