From: Stefan Hajnoczi <stefanha@redhat.com>
To: Jun Li <junmuzi@gmail.com>
Cc: kwolf@redhat.com, Stefan Hajnoczi <stefanha@gmail.com>,
juli@redhat.com, famz@redhat.com, qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [PATCH v2] qcow2: add update refcount table realization for update_refcount
Date: Mon, 15 Sep 2014 10:27:53 +0100 [thread overview]
Message-ID: <20140915092753.GA32739@stefanha-thinkpad.redhat.com> (raw)
In-Reply-To: <20140913155331.GA22493@localhost.localdomain>
[-- Attachment #1: Type: text/plain, Size: 1618 bytes --]
On Sat, Sep 13, 2014 at 11:53:58PM +0800, Jun Li wrote:
> On Fri, 09/05 16:33, Stefan Hajnoczi wrote:
> > On Mon, Sep 01, 2014 at 06:52:48PM +0800, Jun Li wrote:
> >
> > How does this patch handle self-describing refcount blocks? I think
> > they will keep the refcount block alive forever because your code will
> > not decide to free them.
> >
>
> Sorry, I have ignored self-describing refcount blocks. :)
For this...
> > This patch should also discard the refcount block if we decide to free
> > it (in the same way that we discard at cluster_offset).
> >
> > > diff --git a/block/qcow2-refcount.c b/block/qcow2-refcount.c
> > > index 43665b8..63f36e6 100644
> > > --- a/block/qcow2-refcount.c
> > > +++ b/block/qcow2-refcount.c
> > > @@ -586,6 +586,37 @@ static int QEMU_WARN_UNUSED_RESULT update_refcount(BlockDriverState *bs,
> > > if (refcount == 0 && s->discard_passthrough[type]) {
> > > update_refcount_discard(bs, cluster_offset, s->cluster_size);
> > > }
> > > +
> > > + /* When refcount block is NULL, update refcount table */
> > > + if (block_index == 0) {
> >
> > What is the purpose of block_index == 0?
>
> Here is want to reduce the probability of running the following code. Only
> when block_index == 0, we will run the following code to free refcount block.
...and this reason, I consider this approach incomplete.
The approach is unreliable because a change to refcount update ordering
could change leak behavior.
Either free refcount blocks to avoid leaks in all cases, or don't
bother.
Stefan
[-- Attachment #2: Type: application/pgp-signature, Size: 473 bytes --]
next prev parent reply other threads:[~2014-09-15 9:28 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-09-01 10:52 [Qemu-devel] [PATCH v2] qcow2: add update refcount table realization for update_refcount Jun Li
2014-09-01 11:11 ` Benoît Canet
2014-09-01 16:04 ` Jun Li
2014-09-02 13:38 ` Benoît Canet
2014-09-02 17:12 ` Greg Kurz
2014-09-22 1:45 ` jun muzi
2014-09-05 10:21 ` Kevin Wolf
2014-09-09 2:52 ` Jun Li
2014-09-09 8:21 ` Kevin Wolf
2014-09-09 14:04 ` Jun Li
2014-09-05 15:33 ` Stefan Hajnoczi
2014-09-13 15:53 ` Jun Li
2014-09-15 9:27 ` Stefan Hajnoczi [this message]
2014-09-05 15:34 ` Stefan Hajnoczi
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=20140915092753.GA32739@stefanha-thinkpad.redhat.com \
--to=stefanha@redhat.com \
--cc=famz@redhat.com \
--cc=juli@redhat.com \
--cc=junmuzi@gmail.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).