[Sheepdog] [PATCH] sheep: disable object cache by default

Liu Yuan namei.unix at gmail.com
Wed May 9 15:40:45 CEST 2012


On 05/09/2012 08:02 PM, MORITA Kazutaka wrote:

> Liu Yuan wrote:
>> > 
>> > On 05/08/2012 01:48 AM, MORITA Kazutaka wrote:
>> > 
>>> > > For example:
>>> > > 
>>> > >   $ qemu-img convert ~/linux.img sheepdog:linux
>>> > >   $ collie vdi read linux 0 512 | hd | head -1
>>> > >   00000000  fa eb 7c 6c 62 61 4c 49  4c 4f 01 00 15 04 09 00  |..|lbaLILO......|
>>> > >   $ qemu-img snapshot -c snap sheepdog:linux
>>> > >   $ collie vdi read linux 0 512 | hd | head -1
>>> > >   00000000  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|
>>> > > 
>>> > > We cannot read the correct data after snapshotting because the
>>> > > snapshot operation doesn't read the cached data.
>> > 
>> > 
>> > I am surprised you didn't notice that qemu-img convert use 'unsafe' mode
> Of course, I know that.  The problem here is that writethrough
> requests does not read the latest data if the data is not flushed.
> This is a completely wrong behavior as a block storage system, and
> that's the very reason I want to disable it by default.
> 


I don't think so. Actually the writethrough request does read the
'latest' data in the cache. The real culprit has been addressed by
Wujue's patch. See
http://lists.wpkg.org/pipermail/sheepdog/2012-April/002914.html

Simply put, add_vdi() doesn't try to write the data in the object cache
even the object is cached. So the object in the backend becomes
'fresher' than the one in the cache.

I didn't merge the patch because I thought it would be better settle
down the problem in the right place -- that is, qemu-img snapshot,
instead of introducing more complexity to sheep just because of some
improper upper layer's fault.

If you are really concerned of this misbehavior, I think we try re-visit
Wuyue's patch.

Anyway, I think now I am fine with adding a new option to disable object
cache globally, but I don't agree to disable it as default.

Thanks,
Yuan



More information about the sheepdog mailing list