From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from [140.186.70.92] (port=51750 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OwE4u-0000SS-82 for qemu-devel@nongnu.org; Thu, 16 Sep 2010 09:00:46 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1OwE4o-0003XG-Ht for qemu-devel@nongnu.org; Thu, 16 Sep 2010 09:00:40 -0400 Received: from e5.ny.us.ibm.com ([32.97.182.145]:39945) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OwE4o-0003Wh-Ez for qemu-devel@nongnu.org; Thu, 16 Sep 2010 09:00:34 -0400 Received: from d01relay03.pok.ibm.com (d01relay03.pok.ibm.com [9.56.227.235]) by e5.ny.us.ibm.com (8.14.4/8.13.1) with ESMTP id o8GCek0Z021374 for ; Thu, 16 Sep 2010 08:40:46 -0400 Received: from d01av03.pok.ibm.com (d01av03.pok.ibm.com [9.56.224.217]) by d01relay03.pok.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id o8GD0R5h327226 for ; Thu, 16 Sep 2010 09:00:28 -0400 Received: from d01av03.pok.ibm.com (loopback [127.0.0.1]) by d01av03.pok.ibm.com (8.14.4/8.13.1/NCO v10.0 AVout) with ESMTP id o8GD0REN002999 for ; Thu, 16 Sep 2010 10:00:27 -0300 Message-ID: <4C9214E7.6090407@linux.vnet.ibm.com> Date: Thu, 16 Sep 2010 08:00:23 -0500 From: Anthony Liguori MIME-Version: 1.0 References: <1284213896-12705-1-git-send-email-aliguori@us.ibm.com> <1284213896-12705-3-git-send-email-aliguori@us.ibm.com> <4C91D09B.1080202@redhat.com> In-Reply-To: <4C91D09B.1080202@redhat.com> Content-Type: text/plain; charset=ISO-8859-15; format=flowed Content-Transfer-Encoding: 7bit Subject: [Qemu-devel] Re: [PATCH 2/3] block-nbd: fix use of protocols in backing files and nbd probing List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Kevin Wolf Cc: Anthony Liguori , Juan Quintela , qemu-devel@nongnu.org, Stefan Hajnoczi On 09/16/2010 03:08 AM, Kevin Wolf wrote: > Am 11.09.2010 16:04, schrieb Anthony Liguori: > >> The use of protocols in backing_files is currently broken because of some >> checks for adjusting relative pathnames. >> >> Additionally, there's a spurious read when using an nbd protocol that can be >> quite destructive when using copy-on-read. Potentially, this can lead to >> probing an image file over top of NBD but this is completely wrong as NBD >> devices are not growable. >> >> Signed-off-by: Anthony Liguori >> --- >> NB: this is absolutely not ideal. A more elegant suggestion would be >> appreciated. I don't think NBD cleanly fits the model of a protocol as it >> stands today. >> >> diff --git a/block.c b/block.c >> index cd2ee31..a32d5dd 100644 >> --- a/block.c >> +++ b/block.c >> @@ -344,6 +344,12 @@ static int find_image_format(const char *filename, BlockDriver **pdrv) >> return ret; >> } >> >> + if (strcmp(bs->drv->protocol_name, "nbd") == 0) { >> + drv = bs->drv; >> + bdrv_delete(bs); >> + goto out; >> + } >> > Is nbd really the only protocol that behaves like this? I don't like > hardcoding driver names in generic block layer code. > I'll drop this chunk from the patch as using backing_fmt achieves the same goal. The important hunk is the next one that removes assumptions that URIs are filenames. Regards, Anthony Liguori > Kevin >