OSDN Git Service

block/vdi: Add locking for parallel requests
authorMax Reitz <mreitz@redhat.com>
Fri, 27 Feb 2015 19:54:39 +0000 (14:54 -0500)
committerKevin Wolf <kwolf@redhat.com>
Tue, 10 Mar 2015 13:02:24 +0000 (14:02 +0100)
commitf0ab6f109630940146cbaf47d0cd99993ddba824
treee35a0bc66325fe5af721df5fb55de79571574e94
parentaef58bdc1e7d8f37cdf838b49f160c520399c84f
block/vdi: Add locking for parallel requests

When allocating a new cluster, the first write to it must be the one
doing the allocation, because that one pads its write request to the
cluster size; if another write to that cluster is executed before it,
that write will be overwritten due to the padding.

See https://bugs.launchpad.net/qemu/+bug/1422307 for what can go wrong
without this patch.

Cc: qemu-stable <qemu-stable@nongnu.org>
Signed-off-by: Max Reitz <mreitz@redhat.com>
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
block/vdi.c