qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH] Introduce cache images for the QCOW2 format


From: Kaveh Razavi
Subject: Re: [Qemu-devel] [PATCH] Introduce cache images for the QCOW2 format
Date: Wed, 14 Aug 2013 13:42:33 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130804 Thunderbird/17.0.8

On 08/14/2013 01:16 AM, Alex Bligh wrote:
> The above para implies you intend one cache file to be shared by
> two VMs booting from the same backing image on the same node.
> If that's true, how do you protect yourself from the following:
>

Not really. I meant different backing images, and not necessarily
booting on the same host.

>    VM1                                         VM2
> 
> 1.  Read rq for block 1234
> 
> 2.  Start writing block 1234 to cache file
> 
> 3.                                              Read fq for blk 1234
> 
> 4.                                              Read blk 1234 from
>                                                cache file
> 
> 5.  Finish writing block 1234 to cache file
> 
> 
> As far as I can see VM1 could read an incomplete write from
> the cache file.
> 
> Further, unless you're opening these files O_DIRECT, how do you
> know half the writes from VM1 won't be sitting dirty in the page
> cache when you read using VM2?

This is essentially the same as what Eric mentioned in his email. As
long as only one VM writes to the image and it is not simultaneously
used by other VMs this should not happen.

There is little benefit in having a second VM reading from the cache
that is being created by another VM. If the backing file is not opened
with O_DIRECT, the reads from the first VM will likely exist in the host
page cache for the second VM.

Kaveh



reply via email to

[Prev in Thread] Current Thread [Next in Thread]