public inbox for pve-devel@lists.proxmox.com
 help / color / mirror / Atom feed
* [pve-devel] [PATCH manager] vzdump: getlock: return lock file handle and let the caller close it
@ 2021-04-12  8:47 Fabian Ebner
  2021-04-12 12:36 ` [pve-devel] applied: " Thomas Lamprecht
  0 siblings, 1 reply; 2+ messages in thread
From: Fabian Ebner @ 2021-04-12  8:47 UTC (permalink / raw)
  To: pve-devel; +Cc: Thomas Lamprecht

so it doesn't get out of scope too early.

Regression introduced by a06e0311de595e19f6312a12d07c6767365d7a2c as pointed
out by Fabian Grünbichler.

Reported in the community forum:
https://forum.proxmox.com/threads/limit-simultaneous-backup-jobs.87489

Suggested-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
Signed-off-by: Fabian Ebner <f.ebner@proxmox.com>
---
 PVE/API2/VZDump.pm | 4 +++-
 PVE/VZDump.pm      | 2 ++
 2 files changed, 5 insertions(+), 1 deletion(-)

diff --git a/PVE/API2/VZDump.pm b/PVE/API2/VZDump.pm
index 44376106..94bb0605 100644
--- a/PVE/API2/VZDump.pm
+++ b/PVE/API2/VZDump.pm
@@ -106,7 +106,7 @@ __PACKAGE__->register_method ({
 	    $param->{vmids} = $local_vmids;
 	    my $vzdump = PVE::VZDump->new($cmdline, $param, $skiplist);
 
-	    eval {
+	    my $LOCK_FH = eval {
 		$vzdump->getlock($upid); # only one process allowed
 	    };
 	    if (my $err = $@) {
@@ -122,6 +122,8 @@ __PACKAGE__->register_method ({
 		}
 	    }
 	    $vzdump->exec_backup($rpcenv, $user);
+
+	    close($LOCK_FH);
 	};
 
 	open STDOUT, '>/dev/null' if $param->{quiet} && !$param->{stdout};
diff --git a/PVE/VZDump.pm b/PVE/VZDump.pm
index fb4c8bad..171d208e 100644
--- a/PVE/VZDump.pm
+++ b/PVE/VZDump.pm
@@ -621,6 +621,8 @@ sub getlock {
     }
 
     PVE::Tools::file_set_contents($pidfile, $upid);
+
+    return $SERVER_FLCK;
 }
 
 sub run_hook_script {
-- 
2.20.1





^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2021-04-12 12:36 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-04-12  8:47 [pve-devel] [PATCH manager] vzdump: getlock: return lock file handle and let the caller close it Fabian Ebner
2021-04-12 12:36 ` [pve-devel] applied: " Thomas Lamprecht

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