Received: from [140.186.70.92] (port=52362 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1POADK-0000yZ-Lg for qemu-devel@nongnu.org; Thu, 02 Dec 2010 09:34:46 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1POABL-0002mc-Tk for qemu-devel@nongnu.org; Thu, 02 Dec 2010 09:32:49 -0500 Received: from mx1.redhat.com ([209.132.183.28]:52532) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1POABL-0002mQ-Lt for qemu-devel@nongnu.org; Thu, 02 Dec 2010 09:30:47 -0500 Message-ID: <4CF7ADCE.7050704@redhat.com> Date: Thu, 02 Dec 2010 15:31:42 +0100 From: Kevin Wolf MIME-Version: 1.0 References: <1291130056-32441-1-git-send-email-stefanha@linux.vnet.ibm.com> <1291130056-32441-4-git-send-email-stefanha@linux.vnet.ibm.com> In-Reply-To: <1291130056-32441-4-git-send-email-stefanha@linux.vnet.ibm.com> Content-Type: text/plain; charset=ISO-8859-15 Content-Transfer-Encoding: 7bit Subject: [Qemu-devel] Re: [PATCH 3/3] block: Fix the use of protocols in backing files List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Stefan Hajnoczi Cc: Anthony Liguori , qemu-devel@nongnu.org Am 30.11.2010 16:14, schrieb Stefan Hajnoczi: > Backing filenames may contain a protocol. The code currently doesn't > consider this case and produces filenames that embed ":". > Don't combine filenames if the backing filename contains a protocol. > > Based on an earlier patch by Anthony Liguori . > > Signed-off-by: Stefan Hajnoczi > --- > block.c | 15 +++++++++++---- > 1 files changed, 11 insertions(+), 4 deletions(-) > > diff --git a/block.c b/block.c > index 59b69e4..c9a6720 100644 > --- a/block.c > +++ b/block.c > @@ -611,10 +611,17 @@ int bdrv_open(BlockDriverState *bs, const char *filename, int flags, > BlockDriver *back_drv = NULL; > > bs->backing_hd = bdrv_new(""); > - path_combine(backing_filename, sizeof(backing_filename), > - filename, bs->backing_file); > - if (bs->backing_format[0] != '\0') > - back_drv = bdrv_find_format(bs->backing_format); > + if (path_has_protocol(bs->backing_file)) { > + back_drv = bdrv_find_protocol(bs->backing_file); > + pstrcpy(backing_filename, sizeof(backing_filename), > + bs->backing_file); > + } else { > + path_combine(backing_filename, sizeof(backing_filename), > + filename, bs->backing_file); > + if (bs->backing_format[0] != '\0') { > + back_drv = bdrv_find_format(bs->backing_format); > + } > + } Now we ignore bs->backing_format when a protocol is used. We don't even allow using anything on top of that protocol any more, so for example qcow2 over sheepdog would be broken. Maybe a use case that you like better would be QED over http or something. It might still not be a very common use case, but this doesn't look right to me. Probably only the pstrcpy/path_combine should be conditional. I've applied the first two patches of the series to the block branch. Kevin