[sheepdog-users] cache flush: all or nothing

Liu Yuan namei.unix at gmail.com
Thu Jun 6 09:24:48 CEST 2013

On 06/06/2013 12:22 AM, Valerio Pachera wrote:
> Using the cache leads to some side effects.
> One of them is, for example, when  I create a snapshot of a vdi and
> back it up but all cache data is missing.
> (Think of an automated backup that do not flush cache first unless we
> make it more complex).

Did you really meet an data loss for a vdi snapshot? I doubt it, because
OS will issue flush request frequently, one flush at most dozens of
seconds because every meta modification will trigger a flush request if
you are using journaling system like EXT4 or XFS in your guest even if
you don't call fsync(2) manually.

Well, we actually have this problem because we might take snapshot while
the cache is being flushed if the flush takes long time enough.

Fix it for 'collie vdi snapshot' is easy, but for 'qemu-img snapshot' is
not as easy as fixing collie.

I'll post a patch to fix collie later.

> Another side effect it that we probably have to wait pretty long time
> when shutting down a guest.
> For example, I have a guest where backups data are written during the night.
> If I shut it down during the day, i have to wait till it flush all the cache.
> It was doing noting in the morning.
> Is it possible to make sheepdog flush the cache when not busy?
> Not all in one time, but some chunks per time.
> Something like it happens for the usb pen drive.

What file system are you using in your guest? Cache flush is a pretty
frequent operation, so most of the time, your cache is clean and need
nothing to flush when you shutdown VM.

If the VM is doing nothing and shutdown takes a long time, I think there
is something wrong.


More information about the sheepdog-users mailing list