public inbox for pve-devel@lists.proxmox.com
 help / color / mirror / Atom feed
From: Fiona Ebner <f.ebner@proxmox.com>
To: pve-devel@lists.proxmox.com
Subject: [pve-devel] [PATCH qemu-server] qm cleanup: avoid problematic cleanup during rollback
Date: Fri, 28 Nov 2025 13:52:09 +0100	[thread overview]
Message-ID: <20251128125237.117539-1-f.ebner@proxmox.com> (raw)

During preparation for rollback, there already is a VM cleanup. The
rollback operation temporarily drops the file lock for the
configuration while doing rollback of the volumes on the storage
layer. If a shutdown operation or more precisely, the cleanup
thereafter happens concurrently, it can get the file lock and do the
cleanup (a second time) while rollback is running. If a badly timed
deactivate for the volume happens, this can cause issues as reported
in the community forum [0] and confirmed locally (but only managed to
reproduce with 'saferemove').

[0]: https://forum.proxmox.com/threads/174875/post-815273

Signed-off-by: Fiona Ebner <f.ebner@proxmox.com>
---
 src/PVE/CLI/qm.pm | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/src/PVE/CLI/qm.pm b/src/PVE/CLI/qm.pm
index bfce860f..60fe318e 100755
--- a/src/PVE/CLI/qm.pm
+++ b/src/PVE/CLI/qm.pm
@@ -1111,6 +1111,12 @@ __PACKAGE__->register_method({
                 my $pid = PVE::QemuServer::check_running($vmid);
                 die "vm still running\n" if $pid;
 
+                # Rollback already does cleanup when preparing and afterwards temporarily drops the
+                # lock on the configuration file to rollback the volumes. Deactivating volumes here
+                # again while that is happening would be problematic.
+                die "skipping cleanup - 'rollback' lock is present\n"
+                    if $conf->{lock} && $conf->{lock} eq 'rollback';
+
                 if (!$clean) {
                     # we have to cleanup the tap devices after a crash
 
-- 
2.47.3



_______________________________________________
pve-devel mailing list
pve-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel


             reply	other threads:[~2025-11-28 12:52 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-11-28 12:52 Fiona Ebner [this message]
2025-11-29 22:49 ` [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=20251128125237.117539-1-f.ebner@proxmox.com \
    --to=f.ebner@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
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal