From: Kevin Wolf <kwolf@redhat.com>
To: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
Cc: Anthony Liguori <aliguori@us.ibm.com>, qemu-devel@nongnu.org
Subject: [Qemu-devel] Re: [PATCH 3/3] block: Fix the use of protocols in backing files
Date: Thu, 02 Dec 2010 15:31:42 +0100 [thread overview]
Message-ID: <4CF7ADCE.7050704@redhat.com> (raw)
In-Reply-To: <1291130056-32441-4-git-send-email-stefanha@linux.vnet.ibm.com>
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 "<protocol>:".
> Don't combine filenames if the backing filename contains a protocol.
>
> Based on an earlier patch by Anthony Liguori <aliguori@us.ibm.com>.
>
> Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
> ---
> 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
next prev parent reply other threads:[~2010-12-02 14:34 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-11-30 15:14 [Qemu-devel] [PATCH 0/3] block: Fix the use of protocols in backing files Stefan Hajnoczi
2010-11-30 15:14 ` [Qemu-devel] [PATCH 1/3] block: Make bdrv_create_file() ':' handling consistent Stefan Hajnoczi
2010-11-30 15:14 ` [Qemu-devel] [PATCH 2/3] block: Introduce path_has_protocol() function Stefan Hajnoczi
2010-12-09 10:59 ` [Qemu-devel] " Kevin Wolf
2010-11-30 15:14 ` [Qemu-devel] [PATCH 3/3] block: Fix the use of protocols in backing files Stefan Hajnoczi
2010-12-02 14:31 ` Kevin Wolf [this message]
2010-12-02 15:48 ` [Qemu-devel] " Stefan Hajnoczi
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=4CF7ADCE.7050704@redhat.com \
--to=kwolf@redhat.com \
--cc=aliguori@us.ibm.com \
--cc=qemu-devel@nongnu.org \
--cc=stefanha@linux.vnet.ibm.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.