From: Eric Blake <eblake@redhat.com>
To: Xu Wang <gesaint@linux.vnet.ibm.com>, qemu-devel@nongnu.org
Cc: kwolf@redhat.com, stefanha@gmail.com
Subject: Re: [Qemu-devel] [PATCH] block: Fix relative backing file path checking
Date: Thu, 12 Dec 2013 15:35:27 -0700 [thread overview]
Message-ID: <52AA3A2F.9040008@redhat.com> (raw)
In-Reply-To: <1386657774-9342-1-git-send-email-gesaint@linux.vnet.ibm.com>
[-- Attachment #1: Type: text/plain, Size: 2522 bytes --]
On 12/09/2013 11:42 PM, Xu Wang wrote:
> This patch is made for Bug #1257334 (diffuse handling of image
> creation from another path). The cause of it is user could create
> image even though the backing file doesn't exist. Becase backing
s/Becase/, because/
> file checking in the bdrv_img_create() is from the user's current
> path instead of relative path to the image to be created. This patch
> makes qemu check backing file according to the relative path to the
> image to be created. Hence if relative backing file path doesn't
> exist, the backing file checking will fail now.
>
> Test case:
> Reproduce process (from bug page):
> 1. $mkdir a/
> 2. $qemu-img create -f qcow2 a/blob.img 10G
> 3. $qemu-img create -f qcow2 -b a/blob.img a/ovl.img
> Here the actual backing file of ovl.img is a/a/blob.img. But
> the backing file checking will check from the user's current
> path and find a/blob.img successfully. But the path saved in
> the ovl.img is a/a/blob.img. Bug occurred.
>
> After patched:
> The step 3 above an error message will be thrown because backing
> file checking started after got the full path of backing file
> intead of relative path.
s/intead/instead/
>
> Signed-off-by: Xu Wang <gesaint@linux.vnet.ibm.com>
> ---
> block.c | 17 +++++++++++++++--
> 1 file changed, 15 insertions(+), 2 deletions(-)
>
> diff --git a/block.c b/block.c
> index 13f001a..20d2b66 100644
> --- a/block.c
> +++ b/block.c
> @@ -4790,18 +4790,31 @@ void bdrv_img_create(const char *filename, const char *fmt,
> uint64_t size;
> char buf[32];
> int back_flags;
> + char backing_filename_full[PATH_MAX];
I hate code that uses PATH_MAX as an array size. It is not portable to
systems like GNU Hurd. But qemu doesn't compile on GNU Hurd, and you're
not the first user of this construct in the codebase (so the problem
already exists and should be independently cleaned up). So I won't let
it hold up your patch.
> + error_setg_errno(errp, -ret, "Backing file '%s'"
> + "(actual path is '%s') error: %s",
Outputs "Backing file 'foo'(actual path...", which looks bad. You need
a space in the error message either before or after the line break.
The rest of the patch looks okay.
--
Eric Blake eblake redhat com +1-919-301-3266
Libvirt virtualization library http://libvirt.org
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 621 bytes --]
prev parent reply other threads:[~2013-12-12 22:35 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-12-10 6:42 [Qemu-devel] [PATCH] block: Fix relative backing file path checking Xu Wang
2013-12-12 22:35 ` Eric Blake [this message]
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=52AA3A2F.9040008@redhat.com \
--to=eblake@redhat.com \
--cc=gesaint@linux.vnet.ibm.com \
--cc=kwolf@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=stefanha@gmail.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).