]> git.proxmox.com Git - pve-manager.git/commitdiff
vzdump: getlock: return lock file handle and let the caller close it
authorFabian Ebner <f.ebner@proxmox.com>
Mon, 12 Apr 2021 08:47:31 +0000 (10:47 +0200)
committerThomas Lamprecht <t.lamprecht@proxmox.com>
Mon, 12 Apr 2021 12:36:08 +0000 (14:36 +0200)
so it doesn't get out of scope too early.

Regression introduced by 5620e5761efc6617ee8e8b004cfdd604547125fc 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
PVE/VZDump.pm

index 44376106d49b129dc07607e3864b9151aa499b9a..94bb0605a05cb446545bbbe5d2dd61054b6f2605 100644 (file)
@@ -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};
index fb4c8badac900fc865532712c2f3f5c774d4fef5..171d208ee4669299e85c0a7cf3578b750ced1a43 100644 (file)
@@ -621,6 +621,8 @@ sub getlock {
     }
 
     PVE::Tools::file_set_contents($pidfile, $upid);
+
+    return $SERVER_FLCK;
 }
 
 sub run_hook_script {