Skip to contentSkip to conversation

Journal async commit broken for data=ordered?

DISCUSSION Jan Kara 2 participants 3 messages Feb 14, 2012 – Feb 15, 2012

lore
Share & tools
lore

Jan Kara

author
#0 lore raw

Hello,

I've just realized that JBD2_FEATURE_INCOMPAT_ASYNC_COMMIT breaks
guarantees of data=ordered mode in ext4. The problem is that async commit code assumes that when a checksum of a transaction in the journal matches, all necessary data is on disk. This is true for metadata but need not be so for data - the whole transaction may be correctly on pernament storage while some data is still sitting in drive's caches. Thus if a power failure happens at that moment, we have broken guarantees of data=ordered mode. Seeing that async commit code isn't used by default anyway (I remember there used to be some problems with it), shouldn't we just rip it out?

Honza

#1 lore raw
Quoted 9 lines · Jan Kara

I've just realized that JBD2_FEATURE_INCOMPAT_ASYNC_COMMIT breaks
guarantees of data=ordered mode in ext4. The problem is that async commit code assumes that when a checksum of a transaction in the journal matches, all necessary data is on disk. This is true for metadata but need not be so for data - the whole transaction may be correctly on pernament storage while some data is still sitting in drive's caches. Thus if a power failure happens at that moment, we have broken guarantees of data=ordered mode. Seeing that async commit code isn't used by default anyway (I remember there used to be some problems with it), shouldn't we just rip it out?

A better long-term solution would be to submit the block IO in advance of marking the metadata dirty, so the data is safe on disk before the journal becomes involved. That would also avoid the problem of entangling the journal commit latency with IO waiting to be flushed to disk.

Cheers, Andreas

author
#2 lore raw
Quoted 11 lines · Andreas Dilger
Quoted 9 lines · Jan Kara

I've just realized that JBD2_FEATURE_INCOMPAT_ASYNC_COMMIT breaks
guarantees of data=ordered mode in ext4. The problem is that async commit code assumes that when a checksum of a transaction in the journal matches, all necessary data is on disk. This is true for metadata but need not be so for data - the whole transaction may be correctly on pernament storage while some data is still sitting in drive's caches. Thus if a power failure happens at that moment, we have broken guarantees of data=ordered mode. Seeing that async commit code isn't used by default anyway (I remember there used to be some problems with it), shouldn't we just rip it out?

Quoted 3 lines

A better long-term solution would be to submit the block IO in advance of marking the metadata dirty, so the data is safe on disk before the journal becomes involved.

Umm, I don't see how that would really make difference. Unless you flush
disk's caches you can never be sure data made it to disk. And you must make sure data is on disk before anyone has a chance to see transaction writing these data fully written into the log.

Honza

Signature · 2 lines
Jan Kara <[email protected]>
SUSE Labs, CR