On 28/05/15 15:32, Stanislav German-Evtushenko wrote:

What does it mean that operations with buffer are not ensured to be
thread-safe in qemu?

O_DIRECT doesn't guarantee that buffer reading is finished when write
returns if I read "man -s 2 open" correctly.
The statement seems to be not correct.
O_DIRECT does not guarantee that data reaches the undererying hardware
on return but it does guarantee that reading from buffer is finished.
Consinder the following examples.

This is okay:
0. set_buffer
1. write_with_o_direct_from_buffer
2. change_buffer
3. write_with_o_direct_from_buffer
4. change_buffer
5. write_with_o_direct_from_buffer
6. ...

This is not okay and this is what is actually happening:
0. set_buffer
1. start_writing_with_o_direct_from_buffer
2. change_buffer (we can do this only in another thread)
3. finish_writing_with_o_direct_from_buffer
4. change_buffer
5. start_writing_with_o_direct_from_buffer
6. change_buffer (we can do this only in another thread)
7. finish_writing_with_o_direct_from_buffer
8 ...
Wolfgang also explained this, thanks to both.

If there is a concurrency problem in qemu-kvm with block write buffers, we can have problems with any type of cache, only that with cache modes using O_DIRECT and mdraid/drbd it is easier to trigger problems (and also there are other kind of problems, like inconsistent mirroring)?

--
Zuzendari Teknikoa / Director Técnico
Binovo IT Human Project, S.L.
Telf. 943575997
      943493611
Astigarraga bidea 2, planta 6 dcha., ofi. 3-2; 20180 Oiartzun (Gipuzkoa)
www.binovo.es

_______________________________________________
pve-devel mailing list
pve-devel@pve.proxmox.com
http://pve.proxmox.com/cgi-bin/mailman/listinfo/pve-devel

Reply via email to