Re: [PATCH, RFC] virtio_blk: add cache flush command

Anthony Liguori
2009-05-11T16:38:20Z

Christoph Hellwig wrote:
> On Mon, May 11, 2009 at 09:51:40AM -0500, Anthony Liguori wrote:
>
>> What typically triggers a flush operation?
>>
>
> fsync.
>
>
>> I would assume an fsync would, but would a flush happen after every
>> O_DIRECT write?
>>
>
> Right now it doesn't, but it probably should.
>

So then with cache=writeback, fsync behaves itself but O_DIRECT writes
do not.

This seems like a really undesirable combination of behavior from a
guest integrity point of view. It makes me wonder if it's really
useful. I think that any serious user would have to continue using
cache=writethrough. Is there a path that would ever allow someone who
cares about their data to use cache=writeback instead of cache=writethrough?

>> If the backend implementation of T_FLUSH is fsync, I would think that
>> this would result in rather poor performance for O_DIRECT operations in
>> the guest.
>>
>
> Right now it's fsync. By the time I'll submit the backend change it
> will still be fsync, but at least called from the posix-aio-compat
> thread pool.
>

fsync is pretty crappy on ext3 default configs. I'm concerned that this
could be considered a DoS by a malicious guest. If it sat in a T_FLUSH
loop, it would potentially bring your system to a crawl, no?

Regards,

Anthony Liguori