hotplug/Linux: close lockfd after lock attempt
PATCH 1/1 hotplug/Linux: close lockfd after lock attempt
# HG changeset patch
# User Olaf Hering <[email protected]>
# Date 1350143934 -7200
# Node ID 5aa14d5afe6b1f35b23029ae90b7edb20367bbeb # Parent e0e1350dfe9b7a6cacb1378f75d8e6536d22eb2d hotplug/Linux: close lockfd after lock attempt
When a HVM guest is shutdown some of the 'remove' events can not claim the lock for some reason. Instead they try to grab the lock in a busy loop, until udev reaps the xen-hotplug-cleanup helper.
After analyzing the resulting logfile its not obvious what the cause is. The only explanation is that bash (?) gets confused if the same lockfd is opened again and again. Closing it in each iteration seem to fix the issue.
This was observed with sles11sp2 and 4.2 xend.
tools/hotplug/Linux/locking.sh +1 -0
@@ -59,6 +59,7 @@ claim_lock() print "y\n" if $fd_inum eq $file_inum; ' "$_lockfile" ) if [ x$rightfile = xy ]; then break; fi + eval "exec $_lockfd<&-" done }
Quoted 9 lines · Olaf Hering
hotplug/Linux: close lockfd after lock attempt
When a HVM guest is shutdown some of the 'remove' events can not claim the lock for some reason. Instead they try to grab the lock in a busy loop, until udev reaps the xen-hotplug-cleanup helper.
After analyzing the resulting logfile its not obvious what the cause is. The only explanation is that bash (?) gets confused if the same lockfd is opened again and again. Closing it in each iteration seem to fix the issue.
Can be reproduced with this testcase on sles11sp2, not on openSuSE 11.4:
# cat test.sh set -x source locking.sh
l=lockclaim_lock $l
sleep 1release_lock $l
# bash test.sh & bash test.sh & bash test.sh & bash test.sh &
Olaf
Quoted 12 lines · Olaf Hering
Quoted 9 lines · Olaf Hering
hotplug/Linux: close lockfd after lock attempt
When a HVM guest is shutdown some of the 'remove' events can not claim the lock for some reason. Instead they try to grab the lock in a busy loop, until udev reaps the xen-hotplug-cleanup helper.
After analyzing the resulting logfile its not obvious what the cause is. The only explanation is that bash (?) gets confused if the same lockfd is opened again and again. Closing it in each iteration seem to fix the issue.
Quoted 1 line
Can be reproduced with this testcase on sles11sp2, not on openSuSE 11.4:
So this is a bash bug? Have you reported it against bash?
Ian.
Quoted 20 lines
# cat test.sh set -x source locking.shl=lock
claim_lock$l
sleep 1release_lock$l# bash test.sh & bash test.sh & bash test.sh & bash test.sh &Olaf
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel
Quoted 13 lines · Ian Campbell
Quoted 12 lines · Olaf Hering
Quoted 9 lines · Olaf Hering
hotplug/Linux: close lockfd after lock attempt
When a HVM guest is shutdown some of the 'remove' events can not claim the lock for some reason. Instead they try to grab the lock in a busy loop, until udev reaps the xen-hotplug-cleanup helper.
After analyzing the resulting logfile its not obvious what the cause is. The only explanation is that bash (?) gets confused if the same lockfd is opened again and again. Closing it in each iteration seem to fix the issue.
Quoted 3 lines
Quoted 1 line
Can be reproduced with this testcase on sles11sp2, not on openSuSE 11.4:
So this is a bash bug? Have you reported it against bash?
It does not happen with a newer bash: bash 3.2 from sles11sp2 fails, bash 4.1 from openSuSE 11.4 works.
Olaf
Quoted 15 lines · Olaf Hering
Quoted 13 lines · Ian Campbell
Quoted 12 lines · Olaf Hering
Quoted 9 lines · Olaf Hering
hotplug/Linux: close lockfd after lock attempt
When a HVM guest is shutdown some of the 'remove' events can not claim the lock for some reason. Instead they try to grab the lock in a busy loop, until udev reaps the xen-hotplug-cleanup helper.
After analyzing the resulting logfile its not obvious what the cause is. The only explanation is that bash (?) gets confused if the same lockfd is opened again and again. Closing it in each iteration seem to fix the issue.
Quoted 6 lines
Quoted 3 lines
Quoted 1 line
Can be reproduced with this testcase on sles11sp2, not on openSuSE 11.4:
So this is a bash bug? Have you reported it against bash?
It does not happen with a newer bash: bash 3.2 from sles11sp2 fails, bash 4.1 from openSuSE 11.4 works.
I added a comment:
# Some versions of bash appear to be buggy if the same # $_lockfile is opened repeatedly. Close the current fd here.
and reference to the bash version in the commit message.
acked + applied. Thanks.
Quoted 2 lines
Olaf