[pve-devel] [PATCH cluster 1/3] check correct error before releasing lock in cfs_lock

Dominik Csapak d.csapak at proxmox.com
Thu Nov 2 14:22:08 CET 2017


after finishing the code in cfs_lock, we want to release the lock only
when we got it before, so we need to check the correct lock

Signed-off-by: Dominik Csapak <d.csapak at proxmox.com>
---
note: better would be a different approach than parsing the
error message, because this was missed for quite some time
 data/PVE/Cluster.pm | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/data/PVE/Cluster.pm b/data/PVE/Cluster.pm
index 70ce250..26523f1 100644
--- a/data/PVE/Cluster.pm
+++ b/data/PVE/Cluster.pm
@@ -915,8 +915,9 @@ my $cfs_lock = sub {
 	$err = "$msg: no quorum!\n";
     }
 
-    if (!$err || $err !~ /^got lock timeout -/) {
-	rmdir $filename; # cfs unlock
+    if (!$err || $err ne "got lock request timeout\n") {
+	# if we did get the lock, we unlock it
+	rmdir $filename;
     }
 
     if ($err) {
-- 
2.11.0





More information about the pve-devel mailing list