qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Max Reitz <mreitz@redhat.com>
To: Kevin Wolf <kwolf@redhat.com>
Cc: qemu-devel@nongnu.org, Stefan Hajnoczi <stefanha@redhat.com>
Subject: Re: [Qemu-devel] [PATCH v2 3/5] qcow2: Employ metadata overlap checks
Date: Thu, 29 Aug 2013 11:20:29 +0200	[thread overview]
Message-ID: <521F125D.6020805@redhat.com> (raw)
In-Reply-To: <20130829091820.GF2961@dhcp-200-207.str.redhat.com>

Am 29.08.2013 11:18, schrieb Kevin Wolf:
> Am 28.08.2013 um 16:55 hat Max Reitz geschrieben:
>> The pre-write overlap check function is now called before most of the
>> qcow2 writes (aborting it on collision or other error).
>>
>> Signed-off-by: Max Reitz <mreitz@redhat.com>
>> ---
>>   block/qcow2-cache.c    | 17 +++++++++++++++++
>>   block/qcow2-cluster.c  | 21 +++++++++++++++++++++
>>   block/qcow2-snapshot.c | 22 ++++++++++++++++++++++
>>   block/qcow2.c          | 36 +++++++++++++++++++++++++++++++++++-
>>   4 files changed, 95 insertions(+), 1 deletion(-)
>> @@ -1753,10 +1779,18 @@ static int qcow2_save_vmstate(BlockDriverState *bs, QEMUIOVector *qiov,
>>       BDRVQcowState *s = bs->opaque;
>>       int growable = bs->growable;
>>       int ret;
>> +    int64_t offset = qcow2_vm_state_offset(s) + pos;
>>   
>>       BLKDBG_EVENT(bs->file, BLKDBG_VMSTATE_SAVE);
>>       bs->growable = 1;
>> -    ret = bdrv_pwritev(bs, qcow2_vm_state_offset(s) + pos, qiov);
>> +
>> +    ret = qcow2_pre_write_overlap_check(bs, QCOW2_OL_DEFAULT, offset,
>> +                                        qiov->size);
>> +    if (ret < 0) {
>> +        return ret;
>> +    }
>> +
>> +    ret = bdrv_pwritev(bs, offset, qiov);
>>       bs->growable = growable;
>>   
>>       return ret;
> Sorry for not catching it in v1, this one is actually wrong. The
> bdrv_pwritev() is against bs, not bs->file, so you would be comparing
> virtual/guest offsets with physical/host offsets.
Oh, yes, sorry; thanks for noticing. I do this mistake way too often – I 
think it's time for some regex to catch it…

Max

  reply	other threads:[~2013-08-29  9:20 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-08-28 14:55 [Qemu-devel] [PATCH v2 0/5] qcow2: Add metadata overlap checks Max Reitz
2013-08-28 14:55 ` [Qemu-devel] [PATCH v2 1/5] qcow2: Add corrupt bit Max Reitz
2013-08-29  8:23   ` Kevin Wolf
2013-08-29  8:27     ` Max Reitz
2013-08-29  8:57       ` Kevin Wolf
2013-08-28 14:55 ` [Qemu-devel] [PATCH v2 2/5] qcow2: Metadata overlap checks Max Reitz
2013-08-29  8:51   ` Kevin Wolf
2013-08-29  8:57     ` Max Reitz
2013-08-28 14:55 ` [Qemu-devel] [PATCH v2 3/5] qcow2: Employ metadata " Max Reitz
2013-08-29  9:18   ` Kevin Wolf
2013-08-29  9:20     ` Max Reitz [this message]
2013-08-28 14:55 ` [Qemu-devel] [PATCH v2 4/5] qcow2: More complete consistency check Max Reitz
2013-08-29 11:36   ` Kevin Wolf
2013-08-29 12:09     ` Max Reitz
2013-08-28 14:55 ` [Qemu-devel] [PATCH v2 5/5] qemu-iotests: Overlapping cluster allocations Max Reitz

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=521F125D.6020805@redhat.com \
    --to=mreitz@redhat.com \
    --cc=kwolf@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).