From: Fabian Grünbichler Date: Wed, 29 Apr 2020 08:52:51 +0000 (+0200) Subject: cfs_lock: re-raise exceptions X-Git-Url: https://git.proxmox.com/?a=commitdiff_plain;h=c09b0af556d1206041953356ec8f73ec2c97be0a;p=pve-cluster.git cfs_lock: re-raise exceptions so that API paths that raise an exception while holding a CFS lock properly propagate that exception to the client, instead of the stringified version with added noise about locks added to the front. Signed-off-by: Fabian Grünbichler --- diff --git a/data/PVE/Cluster.pm b/data/PVE/Cluster.pm index b4de989..cce681b 100644 --- a/data/PVE/Cluster.pm +++ b/data/PVE/Cluster.pm @@ -609,7 +609,13 @@ my $cfs_lock = sub { alarm($prev_alarm); if ($err) { - $@ = "error with cfs lock '$lockid': $err"; + if (ref($err) eq 'PVE::Exception') { + # re-raise defined exceptions + $@ = $err; + } else { + # add lock info for plain errors + $@ = "error with cfs lock '$lockid': $err"; + } return undef; }