From: Max Reitz <mreitz@redhat.com>
To: Paolo Bonzini <pbonzini@redhat.com>, qemu-block@nongnu.org
Cc: Kevin Wolf <kwolf@redhat.com>,
qemu-stable@nongnu.org, Stefan Hajnoczi <stefanha@redhat.com>,
qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [PATCH v2] block/vdi: Add locking for parallel requests
Date: Fri, 27 Feb 2015 13:27:20 -0500 [thread overview]
Message-ID: <54F0B708.10503@redhat.com> (raw)
In-Reply-To: <54F0B2C3.1010506@redhat.com>
On 2015-02-27 at 13:09, Max Reitz wrote:
> On 2015-02-27 at 12:42, Paolo Bonzini wrote:
>>
>> On 27/02/2015 15:05, Max Reitz wrote:
>>> Concurrently modifying the bmap does not seem to be a good idea;
>>> this patch adds
>>> a lock for it. See https://bugs.launchpad.net/qemu/+bug/1422307 for
>>> what
>>> can go wrong without.
>>>
>>> Cc: qemu-stable <qemu-stable@nongnu.org>
>>> Signed-off-by: Max Reitz <mreitz@redhat.com>
>>> ---
>>> v2:
>>> - Make the mutex cover vdi_co_write() completely [Kevin]
>>> - Add a TODO comment [Kevin]
>> I think I know what the bug is. Suppose you have two concurrent writes
>> to a non-allocated block, one at 16K...32K (in bytes) and one at
>> 32K...48K. The first write is enlarged to contain zeros, the second is
>> not. Then you have two writes in flight:
>>
>> 0 zeros
>> ... zeros
>> 16K data1
>> ... data1
>> 32K zeros data2
>> ... zeros data2
>> 48K zeros
>> ... zeros
>> 64K
>>
>> And the contents of 32K...48K are undefined. If the above diagnosis is
>> correct, I'm not even sure why Max's v1 patch worked...
>
> Maybe that's an issue, too; but the test case I sent out does 1 MB
> requests (and it fails), so this shouldn't matter there.
Considering that test case didn't work for Stefan (Weil), and it fails
in a pretty strange way for me (no output from the qemu-io command at
all, and while most reads from raw were successful, all reads from vdi
failed (the pattern verification failed), maybe that's something
completely different.
Indeed, when I do sub-MB writes, I get sporadic errors which seem much
more related to the original bug report, so it's probably the issue you
found that's the real problem.
Also, my test case suddenly stopped reproducing the issue on my HDD and
only does it on tmpfs. Weird.
Max
>> An optimized fix could be to use a CoRwLock, then:
>
> Yes, I'm actually already working on that.
>
> Max
>
>> - take it shared (read) around the write in the
>> "VDI_IS_ALLOCATED(bmap_entry)" path
>>
>> - take it exclusive (write) around the write in the
>> "!VDI_IS_ALLOCATED(bmap_entry)" path
>>
>> Paolo
next prev parent reply other threads:[~2015-02-27 18:27 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-02-27 14:05 [Qemu-devel] [PATCH v2] block/vdi: Add locking for parallel requests Max Reitz
2015-02-27 16:57 ` Stefan Hajnoczi
2015-02-27 16:57 ` Max Reitz
2015-02-27 17:25 ` Stefan Weil
2015-02-27 17:28 ` Max Reitz
2015-02-27 17:34 ` Stefan Weil
2015-02-27 18:07 ` Stefan Weil
2015-02-27 18:09 ` Max Reitz
2015-02-27 18:12 ` Stefan Weil
2015-02-27 18:15 ` Max Reitz
2015-02-27 18:55 ` Max Reitz
2015-02-27 20:21 ` Stefan Weil
2015-02-27 20:23 ` Max Reitz
2015-02-27 20:37 ` Stefan Weil
2015-02-27 17:35 ` Paolo Bonzini
2015-02-27 17:42 ` Paolo Bonzini
2015-02-27 18:09 ` Max Reitz
2015-02-27 18:27 ` Max Reitz [this message]
2015-02-27 21:44 ` Stefan Weil
2015-02-27 21:46 ` 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=54F0B708.10503@redhat.com \
--to=mreitz@redhat.com \
--cc=kwolf@redhat.com \
--cc=pbonzini@redhat.com \
--cc=qemu-block@nongnu.org \
--cc=qemu-devel@nongnu.org \
--cc=qemu-stable@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.