[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-changelog] [xen-unstable] tools/hotplug: locking.sh script: fix lock directory remains on error bug



# HG changeset patch
# User Ian Jackson <Ian.Jackson@xxxxxxxxxxxxx>
# Date 1278418214 -3600
# Node ID 473c170bca8d0fd0302bb9ba8b9a410cf86ff797
# Parent  4af9f9351beb311f48d32dea654a8387230a6ac6
tools/hotplug: locking.sh script: fix lock directory remains on error bug

_release_lock should be used instead of release_lock.
sigerr is introduced so that it can be redefined by
xen-hotplug-common.sh to a version which writes error status to xenstore.

Signed-off-by: Kouya Shimura <kouya@xxxxxxxxxxxxxx>
---
 tools/hotplug/Linux/locking.sh |    8 +++++++-
 1 files changed, 7 insertions(+), 1 deletion(-)

diff -r 4af9f9351beb -r 473c170bca8d tools/hotplug/Linux/locking.sh
--- a/tools/hotplug/Linux/locking.sh    Tue Jul 06 11:57:20 2010 +0100
+++ b/tools/hotplug/Linux/locking.sh    Tue Jul 06 13:10:14 2010 +0100
@@ -39,6 +39,12 @@ release_lock()
 }
 
 
+# This function will be redefined in xen-hotplug-common.sh.
+sigerr() {
+  exit 1
+}
+
+
 _claim_lock()
 {
   local lockdir="$1"
@@ -47,7 +53,7 @@ _claim_lock()
 
   while [ $retries -lt $LOCK_RETRIES ]
   do
-    mkdir "$lockdir" 2>/dev/null && trap "release_lock $1; sigerr" ERR &&
+    mkdir "$lockdir" 2>/dev/null && trap "_release_lock $lockdir; sigerr" ERR 
&&
       _update_lock_info "$lockdir" && return
 
     local new_owner=$(_lock_owner "$lockdir")

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.