From: Fam Zheng <famz@redhat.com>
To: Xu Wang <cngesaint@gmail.com>, qemu-devel@nongnu.org
Cc: kwolf@redhat.com, wdongxu@linux.vnet.ibm.com, stefanha@gmail.com,
Xu Wang <gesaint@linux.vnet.ibm.com>,
xiawenc@linux.vnet.ibm.com
Subject: Re: [Qemu-devel] [PATCH V7 2/4] block: Add check infinite loop in bdrv_img_create()
Date: Wed, 13 Nov 2013 14:32:48 +0800 [thread overview]
Message-ID: <52831D10.9020706@redhat.com> (raw)
In-Reply-To: <1384310380-9805-3-git-send-email-gesaint@linux.vnet.ibm.com>
On 2013年11月13日 10:39, Xu Wang wrote:
> Backing file loop should be checked before qemu-img create command
> execution. If loop is found, qemu-img create should be stopped and
> an error printed.
>
> Signed-off-by: Xu Wang <gesaint@linux.vnet.ibm.com>
> ---
> block.c | 9 +++++----
> 1 file changed, 5 insertions(+), 4 deletions(-)
>
> diff --git a/block.c b/block.c
> index 3c43179..c2ed6ef 100644
> --- a/block.c
> +++ b/block.c
> @@ -4629,15 +4629,16 @@ void bdrv_img_create(const char *filename, const char *fmt,
> }
>
> backing_file = get_option_parameter(param, BLOCK_OPT_BACKING_FILE);
> + backing_fmt = get_option_parameter(param, BLOCK_OPT_BACKING_FMT);
> if (backing_file && backing_file->value.s) {
> - if (!strcmp(filename, backing_file->value.s)) {
> - error_setg(errp, "Error: Trying to create an image with the "
> - "same filename as the backing file");
> + if (!bdrv_backing_chain_okay(backing_file->value.s,
> + backing_fmt->value.s, filename)) {
> + error_setg(errp, "bdrv_img_create: loop exists, "
> + "image create failed");
Another failure path in file_chain_has_loop() is when bdrv_open fails,
which is not a backing chain loop. What if the backing file doesn't
exist? Would the error message still mention "look exits", which is very
confusing?
Fam
> goto out;
> }
> }
>
> - backing_fmt = get_option_parameter(param, BLOCK_OPT_BACKING_FMT);
> if (backing_fmt && backing_fmt->value.s) {
> backing_drv = bdrv_find_format(backing_fmt->value.s);
> if (!backing_drv) {
>
next prev parent reply other threads:[~2013-11-13 6:33 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-11-13 2:39 [Qemu-devel] [PATCH V7 0/4] Refine and export backing file loop check Xu Wang
2013-11-13 2:39 ` [Qemu-devel] [PATCH V7 1/4] block/qemu-img: Refine and export infinite loop checking in collect_image_info_list() Xu Wang
2013-11-13 6:29 ` Fam Zheng
2013-11-13 2:39 ` [Qemu-devel] [PATCH V7 2/4] block: Add check infinite loop in bdrv_img_create() Xu Wang
2013-11-13 6:32 ` Fam Zheng [this message]
2013-11-13 6:37 ` Fam Zheng
2013-11-13 2:39 ` [Qemu-devel] [PATCH V7 3/4] block: Add backing file loop check in change_backing_file() Xu Wang
2013-11-13 6:35 ` [Qemu-devel] [PATCH V7 0/4] Refine and export backing file loop check Fam Zheng
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=52831D10.9020706@redhat.com \
--to=famz@redhat.com \
--cc=cngesaint@gmail.com \
--cc=gesaint@linux.vnet.ibm.com \
--cc=kwolf@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=stefanha@gmail.com \
--cc=wdongxu@linux.vnet.ibm.com \
--cc=xiawenc@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.