* [PATCH] hotplug/Linux: close lockfd after lock attempt
@ 2012-10-13 15:59 Olaf Hering
2012-10-13 22:35 ` Olaf Hering
0 siblings, 1 reply; 5+ messages in thread
From: Olaf Hering @ 2012-10-13 15:59 UTC (permalink / raw)
To: xen-devel
# HG changeset patch
# User Olaf Hering <olaf@aepfle.de>
# 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.
Signed-off-by: Olaf Hering <olaf@aepfle.de>
diff -r e0e1350dfe9b -r 5aa14d5afe6b tools/hotplug/Linux/locking.sh
--- a/tools/hotplug/Linux/locking.sh
+++ b/tools/hotplug/Linux/locking.sh
@@ -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
}
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] hotplug/Linux: close lockfd after lock attempt
2012-10-13 15:59 [PATCH] hotplug/Linux: close lockfd after lock attempt Olaf Hering
@ 2012-10-13 22:35 ` Olaf Hering
2012-10-15 8:01 ` Ian Campbell
0 siblings, 1 reply; 5+ messages in thread
From: Olaf Hering @ 2012-10-13 22:35 UTC (permalink / raw)
To: xen-devel
On Sat, Oct 13, Olaf Hering wrote:
> 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=lock
claim_lock $l
sleep 1
release_lock $l
# bash test.sh & bash test.sh & bash test.sh & bash test.sh &
Olaf
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] hotplug/Linux: close lockfd after lock attempt
2012-10-13 22:35 ` Olaf Hering
@ 2012-10-15 8:01 ` Ian Campbell
2012-10-15 8:42 ` Olaf Hering
0 siblings, 1 reply; 5+ messages in thread
From: Ian Campbell @ 2012-10-15 8:01 UTC (permalink / raw)
To: Olaf Hering; +Cc: xen-devel@lists.xen.org
On Sat, 2012-10-13 at 23:35 +0100, Olaf Hering wrote:
> On Sat, Oct 13, Olaf Hering wrote:
>
> > 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:
So this is a bash bug? Have you reported it against bash?
Ian.
>
> # cat test.sh
> set -x
> source locking.sh
>
> l=lock
> claim_lock $l
> sleep 1
> release_lock $l
>
>
> # bash test.sh & bash test.sh & bash test.sh & bash test.sh &
>
>
> Olaf
>
> _______________________________________________
> Xen-devel mailing list
> Xen-devel@lists.xen.org
> http://lists.xen.org/xen-devel
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] hotplug/Linux: close lockfd after lock attempt
2012-10-15 8:01 ` Ian Campbell
@ 2012-10-15 8:42 ` Olaf Hering
2012-10-18 8:35 ` Ian Campbell
0 siblings, 1 reply; 5+ messages in thread
From: Olaf Hering @ 2012-10-15 8:42 UTC (permalink / raw)
To: Ian Campbell; +Cc: xen-devel@lists.xen.org
On Mon, Oct 15, Ian Campbell wrote:
> On Sat, 2012-10-13 at 23:35 +0100, Olaf Hering wrote:
> > On Sat, Oct 13, Olaf Hering wrote:
> >
> > > 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:
>
> 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
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] hotplug/Linux: close lockfd after lock attempt
2012-10-15 8:42 ` Olaf Hering
@ 2012-10-18 8:35 ` Ian Campbell
0 siblings, 0 replies; 5+ messages in thread
From: Ian Campbell @ 2012-10-18 8:35 UTC (permalink / raw)
To: Olaf Hering; +Cc: xen-devel@lists.xen.org
On Mon, 2012-10-15 at 09:42 +0100, Olaf Hering wrote:
> On Mon, Oct 15, Ian Campbell wrote:
>
> > On Sat, 2012-10-13 at 23:35 +0100, Olaf Hering wrote:
> > > On Sat, Oct 13, Olaf Hering wrote:
> > >
> > > > 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:
> >
> > 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.
>
> Olaf
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2012-10-18 8:35 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-10-13 15:59 [PATCH] hotplug/Linux: close lockfd after lock attempt Olaf Hering
2012-10-13 22:35 ` Olaf Hering
2012-10-15 8:01 ` Ian Campbell
2012-10-15 8:42 ` Olaf Hering
2012-10-18 8:35 ` Ian Campbell
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).