From: Kouya Shimura Date: Tue, 14 Dec 2010 17:15:48 +0000 (+0000) Subject: tools/hotplug/Linux: forced to release lock if holder process is gone X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=6250b87dcd7eef8ba59a32edc41751b833f990e0;p=xen.git tools/hotplug/Linux: forced to release lock if holder process is gone 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 Acked-by: Ian Jackson Signed-off-by: Ian Jackson --- diff --git a/tools/hotplug/Linux/locking.sh b/tools/hotplug/Linux/locking.sh index 7dbd6bef81..8748d95454 100644 --- a/tools/hotplug/Linux/locking.sh +++ b/tools/hotplug/Linux/locking.sh @@ -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 ]