[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-changelog] [xen-unstable] hotplug/Linux: close lockfd after lock attempt


  • To: xen-changelog@xxxxxxxxxxxxxxxxxxx
  • From: Xen patchbot-unstable <patchbot@xxxxxxx>
  • Date: Fri, 19 Oct 2012 22:11:18 +0000
  • Delivery-date: Fri, 19 Oct 2012 22:11:25 +0000
  • List-id: "Change log for Mercurial \(receive only\)" <xen-changelog.lists.xen.org>

# HG changeset patch
# User Olaf Hering <olaf@xxxxxxxxx>
# Date 1350549301 -3600
# Node ID b3b03536789abbf2c4b7d62377034c1f14c6340c
# Parent  019ca95dfa34efc71b1707f785b5112573e7d02e
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 (bash 3.2) and 4.2 xend.

Signed-off-by: Olaf Hering <olaf@xxxxxxxxx>
Acked-by: Ian Campbell <Ian.campbell@xxxxxxxxxx>
[ ijc -- added the comment ]
Committed-by: Ian Campbell <ian.campbell@xxxxxxxxxx>
---


diff -r 019ca95dfa34 -r b3b03536789a tools/hotplug/Linux/locking.sh
--- a/tools/hotplug/Linux/locking.sh    Thu Oct 18 09:35:00 2012 +0100
+++ b/tools/hotplug/Linux/locking.sh    Thu Oct 18 09:35:01 2012 +0100
@@ -59,6 +59,9 @@ claim_lock()
             print "y\n" if $fd_inum eq $file_inum;
                              ' "$_lockfile" )
         if [ x$rightfile = xy ]; then break; fi
+       # Some versions of bash appear to be buggy if the same
+       # $_lockfile is opened repeatedly. Close the current fd here.
+        eval "exec $_lockfd<&-"
     done
 }
 

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.