qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH v4 1/1] block: pass the right options for BlockD


From: Dong Jia Shi
Subject: Re: [Qemu-devel] [PATCH v4 1/1] block: pass the right options for BlockDriver.bdrv_open()
Date: Thu, 6 Apr 2017 09:15:42 +0800
User-agent: Mutt/1.7.0 (2016-08-17)

* Max Reitz <address@hidden> [2017-04-05 15:54:14 +0200]:

> 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 <address@hidden>
> > Signed-off-by: Dong Jia Shi <address@hidden>
> > ---
> >  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
Thank you!

> 
> Max
> 




-- 
Dong Jia Shi




reply via email to

[Prev in Thread] Current Thread [Next in Thread]