On Thu, Nov 17, 2011 at 1:43 PM, Paolo Bonzini <pbonz...@redhat.com> wrote: > On 11/17/2011 02:40 PM, Stefan Hajnoczi wrote: >> >> When copy-on-read is enabled it is necessary to wait for overlapping >> requests before issuing new requests. This prevents races between the >> copy-on-read and a write request. > > What about discards?
To get into an interesting scenario the guest would need to issue overlapping read and discard requests. QEMU with copy-on-read turns this into either: discard, read-from-backing-file, write-to-image-file read-from-backing-file, discard, write-to-image-file read-from-backing-file, write-to-image-file, discard There is no issue with any of these orderings. In the worst case we end up with allocated image space where the guest issued a discard. But since discard is a hint anyway it doesn't matter. Stefan