[pve-devel] [RFC v2 pve-ha-manager 1/9] Hardware: remove unnecessary lock in get_node_info

Thomas Lamprecht t.lamprecht at proxmox.com
Mon Dec 14 15:29:53 CET 2015


This lock is not needed asthe status gets written with
file_set_contents from PVE::Tools which is atomic (fuse bug does
not apply here) so we do not need to be scared that we read
inconsistent data.

This also prevents a deadlock if any function needs to know if the
simulated node is quorate in a locked context, like
sim_hardware_cmd is.

Signed-off-by: Thomas Lamprecht <t.lamprecht at proxmox.com>
---
 src/PVE/HA/Sim/Hardware.pm | 10 ++--------
 1 file changed, 2 insertions(+), 8 deletions(-)

diff --git a/src/PVE/HA/Sim/Hardware.pm b/src/PVE/HA/Sim/Hardware.pm
index a77668f..24ef68b 100644
--- a/src/PVE/HA/Sim/Hardware.pm
+++ b/src/PVE/HA/Sim/Hardware.pm
@@ -364,14 +364,8 @@ my $compute_node_info = sub {
 sub get_node_info {
     my ($self) = @_;
 
-    my ($node_info, $quorate);
-
-    my $code = sub { 
-	my $cstatus = $self->read_hardware_status_nolock();
-	($node_info, $quorate) = &$compute_node_info($self, $cstatus); 
-    };
-
-    $self->global_lock($code);
+    my $cstatus = $self->read_hardware_status_nolock();
+    my ($node_info, $quorate) = &$compute_node_info($self, $cstatus);
 
     return ($node_info, $quorate);
 }
-- 
2.1.4





More information about the pve-devel mailing list