diff options
author | Kevin Wolf <kwolf@redhat.com> | 2012-04-26 19:41:22 +0200 |
---|---|---|
committer | Kevin Wolf <kwolf@redhat.com> | 2012-05-07 19:33:18 +0200 |
commit | 54e6814360ab2110ed3ed07b2b9a3f9907e1202a (patch) | |
tree | af61ea6b6337c45a9e35c7af3e68b6f1503dd3ac /block.c | |
parent | 115c2b5a6806615206dfa5518509911bfc7b1d07 (diff) |
qcow2: Limit COW to where it's needed
This fixes a regression introduced in commit 250196f1. The bug leads to
data corruption, found during an Autotest run with a Fedora 8 guest.
Consider a write request whose first part is covered by an already
allocated cluster, but additional clusters need to be newly allocated.
When counting the number of clusters to allocate, the qcow2 code would
decide to do COW for all remaining clusters of the write request, even
if some of them are already allocated.
If during this COW operation another write request is issued that touches
the same cluster, it will still refer to the old cluster. When the COW
completes, the first request will update the L2 table and the second
write request will be lost. Note that the requests need not overlap, it's
enough for them to touch the same cluster.
This patch ensures that only clusters that really require COW are
considered for allocation. In this case any other request writing to the
same cluster will be an allocating write and gets serialised.
Reported-by: Marcelo Tosatti <mtosatti@redhat.com>
Tested-by: Marcelo Tosatti <mtosatti@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Diffstat (limited to 'block.c')
0 files changed, 0 insertions, 0 deletions