diff options
author | Kouya Shimura <kouya@jp.fujitsu.com> | 2010-12-14 17:15:48 +0000 |
---|---|---|
committer | Kouya Shimura <kouya@jp.fujitsu.com> | 2010-12-14 17:15:48 +0000 |
commit | 6250b87dcd7eef8ba59a32edc41751b833f990e0 (patch) | |
tree | fdcec0f6c3453fada85b51f97a9b0ee861c84416 /tools/hotplug | |
parent | d310383831923070727745af97776dcb6078e4f7 (diff) | |
download | xen-6250b87dcd7eef8ba59a32edc41751b833f990e0.tar.gz xen-6250b87dcd7eef8ba59a32edc41751b833f990e0.tar.bz2 xen-6250b87dcd7eef8ba59a32edc41751b833f990e0.zip |
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 <kouya@jp.fujitsu.com>
Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
Diffstat (limited to 'tools/hotplug')
-rw-r--r-- | tools/hotplug/Linux/locking.sh | 6 |
1 files changed, 6 insertions, 0 deletions
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 ] |