lanconnected / EnhanceIO

EnhanceIO Open Source for Linux
Other
101 stars 31 forks source link

Will writeback module cause data inconsistencies ? #37

Closed Jish-Du closed 6 years ago

Jish-Du commented 6 years ago

While learning the enhanceio, I have a question about status change.

According to my understanding, if an IO(A) do cache_write , and some cache block will turn into VALID|CACHEWRITEINPROG in function eio_write_peek(). At the same time , if another IO(B) hit the same cache block ,it will do uncached_write which actually only write disk.

When the IO(B) finished , the callback function will update these blocks status. Because of the IO(A) had finished ,the block in VALID|CACHEWRITEINPROG changes to ALREADY_DIRTY . It will not be invalid by IO(B) although it has old data.

Will it lead to data inconsistencies ? Maybe my expression is not very clear. I try to draw the flowchart.

79p 4n3x nmsf xkyig 84

Would you please explain it ?

rezass commented 6 years ago

If I understand correctly, B is issued before A is completed. Linux does not quarantee order of on-going write requests if you don't provide some flags in requests.