]> git.proxmox.com Git - pve-cluster.git/blobdiff - data/PVE/API2/ClusterConfig.pm
API: correctly propagate $@ with nested locks
[pve-cluster.git] / data / PVE / API2 / ClusterConfig.pm
index 6d23056a6b2a7b2a3c6ba299d46334c0c1d870cf..0daa9e76199fa7b510b16703d127fe601fa2bad2 100644 (file)
@@ -172,7 +172,11 @@ my $config_change_lock = sub {
        PVE::Cluster::cfs_update(1);
        my $members = PVE::Cluster::get_members();
        if (scalar(keys %$members) > 1) {
-           return PVE::Cluster::cfs_lock_file('corosync.conf', 10, $code);
+           my $res = PVE::Cluster::cfs_lock_file('corosync.conf', 10, $code);
+           # cfs_lock_file only sets $@
+           # lock_file does not propagate $@ unless we die here
+           die $@ if defined($@);
+           return $res;
        } else {
            return $code->();
        }