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-devel

[Xen-devel] Re: [PATCH] hotplug: allow hardlinked files for block device

To: Olaf Hering <olaf@xxxxxxxxx>
Subject: [Xen-devel] Re: [PATCH] hotplug: allow hardlinked files for block device images
From: Paolo Bonzini <pbonzini@xxxxxxxxxx>
Date: Mon, 17 Jan 2011 16:48:03 +0100
Cc: xen-devel@xxxxxxxxxxxxxxxxxxx, Stefano Stabellini <Stefano.Stabellini@xxxxxxxxxxxxx>
Delivery-date: Mon, 17 Jan 2011 07:48:57 -0800
Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:sender:message-id:date:from:user-agent :mime-version:to:cc:subject:references:in-reply-to:content-type :content-transfer-encoding; bh=K5Xmrhu13qk1hZuUWOAlJ0eeAMsL/qM6k+3pVVRPdkM=; b=M9Msxy+vrdzvHK3feYIOZXnBwxw+u/5U3CNDSOCU1YN96VKuB1pdLwjOPXWS4WoaeS U81LkdXseWbcWuVVHH5TaHKYowSPlFyUoB8r4nZX+3l5oUTaQ8I2+pSIw6WQT1p9j8YQ 2Vg2+4AwuIMiIRKU8yhb7VSVO77ATyAIT6Suc=
Domainkey-signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=sender:message-id:date:from:user-agent:mime-version:to:cc:subject :references:in-reply-to:content-type:content-transfer-encoding; b=keoT8NgLWtQQMtso2KTTJfdCXZwM/X9OKzyfVxDRA85q30SMN+Hazv2Ld2SBbJ9ugS MRLvK2dgNY0hxw7RbbTW6IIsLe5lE4nfuAIhrCoo4mc5ltzW/kSNorZQqDeHx4x0Mvbi zs5MxfdxNvvjtT3FURRXs1N4zAgltvt0CeodU=
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
In-reply-to: <20101126135555.GA27483@xxxxxxxxx>
List-help: <mailto:xen-devel-request@lists.xensource.com?subject=help>
List-id: Xen developer discussion <xen-devel.lists.xensource.com>
List-post: <mailto:xen-devel@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=unsubscribe>
References: <20101126135555.GA27483@xxxxxxxxx>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
User-agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.13) Gecko/20101209 Fedora/3.1.7-0.35.b3pre.fc14 Lightning/1.0b3pre Mnenhy/0.8.3 Thunderbird/3.1.7
On 11/26/2010 02:55 PM, Olaf Hering wrote:
tools/hotplug/Linux/block change for this losetup -a output:
(inode 12 is listed twice due to hardlinks)

/dev/loop0: [0809]:139267 (/abuild/vdisk-sles11_2-disk0)
/dev/loop1: [0809]:139266 (/abuild/vdisk-sles11_1-disk1)
/dev/loop3: [0809]:139267 (/abuild/vdisk-sles11_2-disk0)
/dev/loop5: [0809]:139273 (/abuild/vdisk-sles11_5-disk1)
/dev/loop8: [0809]:12 (/abuild/bootiso-xenpaging-sles11_5.iso)
/dev/loop10: [0809]:12 (/abuild/bootiso-xenpaging-sles11_4.iso)
/dev/loop11: [0809]:139271 (/abuild/vdisk-sles11_4-disk0)

Without this change, $dev would contain /dev/loop8\n/dev/loop10
Applies to 4.0 and 4.1

Signed-off-by: Olaf Hering<olaf@xxxxxxxxx>

---
  tools/hotplug/Linux/block |    4 ++--
  1 file changed, 2 insertions(+), 2 deletions(-)

--- xen-4.0.1-testing.orig/tools/hotplug/Linux/block
+++ xen-4.0.1-testing/tools/hotplug/Linux/block
@@ -279,8 +279,8 @@ mount it read-write in a guest domain."
              fatal "Unable to lookup $file: dev: $dev inode: $inode"
            fi

-          shared_list=$(losetup -a | grep ' \[0*'${dev}'\]:'${inode} |
-                cut -d : -f 1)
+          shared_list=$(losetup -a |
+                sed -n -e 
"s@^\([^:]\+\)\(:[[:blank:]]\[${dev}\]:${inode}[[:blank:]](${file})\)@\1@p" )

Isn't this incorrect in case ${file} contains a character that is a regex escape (e.g. a star or backslash)?

Paolo

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