From: Kevin Wolf <kwolf@redhat.com>
To: Paolo Bonzini <pbonzini@redhat.com>
Cc: qemu-devel@nongnu.org, stefanha@redhat.com
Subject: Re: [Qemu-devel] [PATCH] qcow2: Fix segfault in qcow2_invalidate_cache
Date: Mon, 18 Mar 2013 14:16:05 +0100 [thread overview]
Message-ID: <20130318131605.GD2476@dhcp-200-207.str.redhat.com> (raw)
In-Reply-To: <51470B32.8080004@redhat.com>
Am 18.03.2013 um 13:40 hat Paolo Bonzini geschrieben:
> Il 18/03/2013 13:10, Kevin Wolf ha scritto:
> > Need to pass an options QDict to qcow2_open() now. This fixes a segfault
> > on the migration target with qcow2.
> >
> > Signed-off-by: Kevin Wolf <kwolf@redhat.com>
> > ---
> > block/qcow2.c | 12 ++++++++++--
> > block/qcow2.h | 3 +++
> > 2 files changed, 13 insertions(+), 2 deletions(-)
> >
> > diff --git a/block/qcow2.c b/block/qcow2.c
> > index b90dd9e..7fcdc62 100644
> > --- a/block/qcow2.c
> > +++ b/block/qcow2.c
> > @@ -29,6 +29,7 @@
> > #include "block/qcow2.h"
> > #include "qemu/error-report.h"
> > #include "qapi/qmp/qerror.h"
> > +#include "qapi/qmp/qbool.h"
> > #include "trace.h"
> >
> > /*
> > @@ -520,7 +521,7 @@ static int qcow2_open(BlockDriverState *bs, QDict *options, int flags)
> > goto fail;
> > }
> >
> > - s->use_lazy_refcounts = qemu_opt_get_bool(opts, "lazy_refcounts",
> > + s->use_lazy_refcounts = qemu_opt_get_bool(opts, QCOW2_OPT_LAZY_REFCOUNTS,
> > (s->compatible_features & QCOW2_COMPAT_LAZY_REFCOUNTS));
>
> Why not add
>
> s->use_lazy_refcounts ||
>
> to the default, and just use an empty QDict in qcow2_invalidate_cache?
I think it's better not to depend on any previous state in qcow2_open(),
but start from scratch with all options directly passed. Otherwise it
would become easy to lose the overview over the data flow.
Also, qcow2_invalidate_cache clears the state so that all other
information in s is properly reset:
memset(s, 0, sizeof(BDRVQcowState));
So s->use_lazy_refcounts doesn't even have it's old value any more.
Kevin
prev parent reply other threads:[~2013-03-18 13:16 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-03-18 12:10 [Qemu-devel] [PATCH] qcow2: Fix segfault in qcow2_invalidate_cache Kevin Wolf
2013-03-18 12:40 ` Paolo Bonzini
2013-03-18 13:16 ` Kevin Wolf [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=20130318131605.GD2476@dhcp-200-207.str.redhat.com \
--to=kwolf@redhat.com \
--cc=pbonzini@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=stefanha@redhat.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).