From: Max Reitz <mreitz@redhat.com>
To: Dong Jia Shi <bjsdjshi@linux.vnet.ibm.com>,
qemu-block@nongnu.org, kwolf@redhat.com
Cc: qemu-devel@nongnu.org, cornelia.huck@de.ibm.com, borntraeger@de.ibm.com
Subject: Re: [Qemu-devel] [PATCH v4 1/1] block: pass the right options for BlockDriver.bdrv_open()
Date: Wed, 5 Apr 2017 15:54:14 +0200 [thread overview]
Message-ID: <0910cdba-6e7b-169f-784a-a0e064f2c71d@redhat.com> (raw)
In-Reply-To: <20170405091909.36357-2-bjsdjshi@linux.vnet.ibm.com>
[-- Attachment #1: Type: text/plain, Size: 1507 bytes --]
On 05.04.2017 11:19, Dong Jia Shi wrote:
> raw_open() expects the caller always passing in the right actual
> @options parameter. But when trying to applying snapshot on a RBD
> image, bdrv_snapshot_goto() calls raw_open() (by calling the
> bdrv_open callback on the BlockDriver) with a NULL @options, and
> that will result in a Segmentation fault.
>
> For the other non-raw format drivers, it also makes sense to passing
> in the actual options, althought they don't trigger the problem so
> far.
>
> Let's prepare a @options by adding the "file" key-value pair to a
> copy of the actual options that were given for the node (i.e.
> bs->options), and pass it to the callback.
>
> BlockDriver.bdrv_open() expects bs->file to be NULL and just
> overwrites it with the result from bdrv_open_child(). That means we
> should actually make sure it's NULL because otherwise the child BDS
> will have a reference count that is 1 too high. So we unconditionally
> invoke bdrv_unref_child() before calling BlockDriver.bdrv_open(), and
> we wrap everything in bdrv_ref()/bdrv_unref() so the BDS isn't
> deleted in the meantime.
>
> Suggested-by: Max Reitz <mreitz@redhat.com>
> Signed-off-by: Dong Jia Shi <bjsdjshi@linux.vnet.ibm.com>
> ---
> block/snapshot.c | 26 +++++++++++++++++++++++---
> 1 file changed, 23 insertions(+), 3 deletions(-)
Thank you, I've applied the patch to my block branch (for inclusion in 2.9):
https://github.com/XanClic/qemu/commits/block
Max
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 512 bytes --]
next prev parent reply other threads:[~2017-04-05 13:54 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-04-05 9:19 [Qemu-devel] [PATCH v4 0/1] block: pass the right options for BlockDriver.bdrv_open() Dong Jia Shi
2017-04-05 9:19 ` [Qemu-devel] [PATCH v4 1/1] " Dong Jia Shi
2017-04-05 13:54 ` Max Reitz [this message]
2017-04-06 1:15 ` Dong Jia Shi
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=0910cdba-6e7b-169f-784a-a0e064f2c71d@redhat.com \
--to=mreitz@redhat.com \
--cc=bjsdjshi@linux.vnet.ibm.com \
--cc=borntraeger@de.ibm.com \
--cc=cornelia.huck@de.ibm.com \
--cc=kwolf@redhat.com \
--cc=qemu-block@nongnu.org \
--cc=qemu-devel@nongnu.org \
/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).