mirror of
https://github.com/xen-project/xen.git
synced 2026-10-29 02:30:03 +01:00
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@jp.fujitsu.com>
This commit is contained in:
1 parent
2157eba42a
commit
0c85cce09c
1 file changed
+7
-1
@@ -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")
|
||||
|
||||