WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-changelog

[Xen-changelog] [xen-unstable] Linux vbd hotplug: Avoid "leaked" loopbac

To: xen-changelog@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-changelog] [xen-unstable] Linux vbd hotplug: Avoid "leaked" loopback devices
From: Xen patchbot-unstable <patchbot-unstable@xxxxxxxxxxxxxxxxxxx>
Date: Tue, 03 Nov 2009 01:45:34 -0800
Delivery-date: Tue, 03 Nov 2009 01:45:50 -0800
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-changelog-request@lists.xensource.com?subject=help>
List-id: BK change log <xen-changelog.lists.xensource.com>
List-post: <mailto:xen-changelog@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=unsubscribe>
Reply-to: xen-devel@xxxxxxxxxxxxxxxxxxx
Sender: xen-changelog-bounces@xxxxxxxxxxxxxxxxxxx
# HG changeset patch
# User Keir Fraser <keir.fraser@xxxxxxxxxx>
# Date 1257237535 0
# Node ID 2ddad83e9733b006afb1169fe8a1bc02cfa41848
# Parent  98593d8d262e3cd15d06b0dd42cc137c23e857af
Linux vbd hotplug: Avoid "leaked" loopback devices

Avoid races between hotplug "add" and "remove" leading to "leaked"
loopback devices.

- Don't setup loopback device if xend is no longer waiting for the
  vbd.
- Use the lock file to avoid add/remove races.

Signed-off-by: Gary Grebus <gary.grebus@xxxxxxxxxx>
---
 tools/hotplug/Linux/block |   11 +++++++++++
 1 files changed, 11 insertions(+)

diff -r 98593d8d262e -r 2ddad83e9733 tools/hotplug/Linux/block
--- a/tools/hotplug/Linux/block Tue Nov 03 08:37:52 2009 +0000
+++ b/tools/hotplug/Linux/block Tue Nov 03 08:38:55 2009 +0000
@@ -232,6 +232,15 @@ case "$command" in
         mode=$(canonicalise_mode "$mode")
 
         claim_lock "block"
+
+        # Avoid a race with the remove if the path has been deleted, or
+       # otherwise changed from "InitWait" state e.g. due to a timeout
+        xenbus_state=$(xenstore_read_default "$XENBUS_PATH/state" 'unknown')
+        if [ "$xenbus_state" != '2' ]
+        then
+          release_lock "block"
+          fatal "Path closed or removed during hotplug add: $XENBUS_PATH 
state: $xenbus_state"
+        fi
 
         if [ "$mode" = 'w' ] && ! stat "$file" -c %A | grep -q w
         then
@@ -363,8 +372,10 @@ mount it read-write in a guest domain."
        ;;
 
       file)
+        claim_lock "block"
         node=$(xenstore_read "$XENBUS_PATH/node")
        losetup -d "$node"
+        release_lock "block"
        exit 0
        ;;
 

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

<Prev in Thread] Current Thread [Next in Thread>
  • [Xen-changelog] [xen-unstable] Linux vbd hotplug: Avoid "leaked" loopback devices, Xen patchbot-unstable <=