[pve-devel] Default cache mode for VM hard drives

Stanislav German-Evtushenko ginermail at gmail.com
Thu May 28 14:07:24 CEST 2015


Dietmar,

>> I'm not kernel/IO expert in any way, but I think this test program has a
>> race condition, so it is not helping us diagnose the problem.
>>
>> We're writing to buffer x while it is in use by write syscall. This is
>> plainly wrong on userspace.
>
> For this test, we do not care about userspace semantics. The point is
> that it results in damaged RAID, which should never! happen.

Without O_DIRECT we trust host cache and we consider host cache reliable.

With O_DIRECT we have to trust our user space application because data
is getting by kernel directly from the application memory. We can
think that kernel could copy buffer from user space before writing it
to block device however it would mean we re-implement "host cache"
again. O_DIRECT is designed for performance and it should avoid any
"copying" jobs.

BTW: Linus Torvalds considers O_DIRECT broken by design and thinks it
must never been used. At the same time it is widely used.


Stanislav



More information about the pve-devel mailing list