WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-devel

[Xen-devel] [PATCH] tools/hotplug/Linux: forced to release lock if holde

To: xen-devel@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-devel] [PATCH] tools/hotplug/Linux: forced to release lock if holder process is gone
From: Kouya Shimura <kouya@xxxxxxxxxxxxxx>
Date: Tue, 14 Dec 2010 17:38:24 +0900
Delivery-date: Tue, 14 Dec 2010 00:39:37 -0800
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-devel-request@lists.xensource.com?subject=help>
List-id: Xen developer discussion <xen-devel.lists.xensource.com>
List-post: <mailto:xen-devel@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=unsubscribe>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
When a script using locking.sh is stopped by ctrl-C, the lock file remains.
We have to wait 100 seconds for releasing the lock at the next time.

Signed-off-by: Kouya Shimura <kouya@xxxxxxxxxxxxxx>

diff -r 89116f28083f tools/hotplug/Linux/locking.sh
--- a/tools/hotplug/Linux/locking.sh    Wed Dec 08 10:46:31 2010 +0000
+++ b/tools/hotplug/Linux/locking.sh    Mon Dec 13 10:36:25 2010 +0900
@@ -61,6 +61,12 @@ _claim_lock()
     then
       owner="$new_owner"
       retries=0
+    else
+      local pid=$(echo $owner | cut -d : -f 1)
+      if [ ! -f "/proc/$pid/status" ]
+      then
+        _release_lock $lockdir
+      fi
     fi
 
     if [ $retries -gt $LOCK_SPINNING_RETRIES ]
_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel