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