[Zetaback-devel] [zetaback commit] r152 - branches/sendr

svn-commit at lists.omniti.com svn-commit at lists.omniti.com
Wed Nov 11 14:13:42 EST 2009


Author: mark
Date: 2009-11-11 14:13:41 -0500 (Wed, 11 Nov 2009)
New Revision: 152

Modified:
   branches/sendr/zetaback.in
Log:
Change lockfile location to prevent mount errors if a backup fails

Modified: branches/sendr/zetaback.in
===================================================================
--- branches/sendr/zetaback.in	2009-11-11 19:09:51 UTC (rev 151)
+++ branches/sendr/zetaback.in	2009-11-11 19:13:41 UTC (rev 152)
@@ -500,11 +500,9 @@
 sub lock($;$$) {
   my ($host, $file, $nowait) = @_;
   print "Acquiring lock for $host:$file\n" if($DEBUG);
-  $file ||= 'master.lock';
-  my $store = config_get($host, 'store');
-  $store =~ s/%h/$host/g;
+  $file ||= 'master';
   return 1 if(exists($locks{"$host:$file"}));
-  open(LOCK, "+>>$store/$file") || return 0;
+  open(LOCK, "+>>/tmp/$host.$file.lock") || return 0;
   unless(flock(LOCK, LOCK_EX | ($nowait ? LOCK_NB : 0))) {
     close(LOCK);
     return 0;
@@ -515,12 +513,10 @@
 sub unlock($;$$) {
   my ($host, $file, $remove) = @_;
   print "Releasing lock for $host:$file\n" if($DEBUG);
-  $file ||= 'master.lock';
-  my $store = config_get($host, 'store');
-  $store =~ s/%h/$host/g;
+  $file ||= 'master';
   return 0 unless(exists($locks{"$host:$file"}));
   *UNLOCK = $locks{$file};
-  unlink("$store/$file") if($remove);
+  unlink("/tmp/$host.$file.lock") if($remove);
   flock(UNLOCK, LOCK_UN);
   close(UNLOCK);
   return 1;



More information about the Zetaback-devel mailing list