Ext3 generally works without barriers because hard drive write caches usually write the journal first for whatever reasons. From what I recall reading, because the journal is all in one chunk at the beginning of the drive far away from the data, and that write caches usually flush in-order from lowest block to highest.
Note all the generally and usually qualifiers in there.
I recall reading about Ext3 journal corruption issues when the power fails as the journal is wrapping around, because the drive writes the end of the journal, some data, then back to the beginning of the journal instead of writing end of the journal, start of the journal, some data.
Posted Jan 29, 2009 16:47 UTC (Thu) by anton (guest, #25547)
[Link]
Who knows what drives do or don't do when in write-caching mode? The
last time I
tested this 10 years ago the drives I used apparently wrote the
blocks in-order, except when a block was overwritten; then the data
might never reach the platter (if it's overwritten again and again).
I should do some experiments with my new drives.
Also, why should writing to the journal first be safer than writing
the other stuff first? With meta-data journaling as typically used in
ext3 this would lead to typical meta-data
update bugs.
Actually the data=ordered mode writes the data before the
corresponding journal entries to prevent that from happening. So if
the disks then write the journal entries before the data thanks to
write-caching disks without barriers, that subverts the safety
data=ordered provides. If the disks write stuff out-of-order in other
ways, other failure modes are possible.
I guess that the reason we don't see lots of reports of data
destroyed by ext3 without barriers is that most people don't have lots
of write traffic going on (but then they won't notice any performance
penalty from barriers either), and you expect to lose the file you
write when the system dies anyway.