From mboxrd@z Thu Jan 1 00:00:00 1970 From: Kouya Shimura Subject: [PATCH] tools/hotplug/Linux: forced to release lock if holder process is gone Date: Tue, 14 Dec 2010 17:38:24 +0900 Message-ID: <7kk4jchhpw.fsf@jp.fujitsu.com> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="vcF06xYdpU" Content-Transfer-Encoding: 7bit Return-path: List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xensource.com Errors-To: xen-devel-bounces@lists.xensource.com To: xen-devel@lists.xensource.com List-Id: xen-devel@lists.xenproject.org --vcF06xYdpU Content-Type: text/plain; charset=us-ascii Content-Description: message body text Content-Transfer-Encoding: 7bit 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 --vcF06xYdpU Content-Type: text/x-patch Content-Disposition: inline; filename="locking.sh.patch" Content-Transfer-Encoding: 7bit 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 ] --vcF06xYdpU Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel --vcF06xYdpU--