[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

Writes ordering in Ext3



Hi,

I have a doubt in the ordering of writes in ext3. Any help is
appreciated.

Ext3 enforces certain ordering in writes to ensure data integrity. For
example, the journal writes are issued first and only after their
successful completion the actual writes are issued.

Sometimes we need to maintain ordering across transactions also. This is
needed because if the actual writes of one transaction and the journal
writes of another transaction are scheduled differently then data
integrity may be lost.

For example, assume we have two transactions T1 and T2 modifying
block b1 and b2 of a file respectively.


(1) T1: Modify block b1.
(2) T1: Issue the journal write for block b1.
(3) T1: Issue the actual write to block b1.
(4) T2: Modify block b2.
(5) T2: Issue the journal write for block b2.
(6) T2: Issue the actual write to block b2.

Now, notice that if the file system is not enforcing ordering across
transactions, then writes (3) and (5) may get reordered by the disk
scheduler (which doesn't know about journaling) such that (5) happens
first and then (3) happens.

In such a case, if the system crashes after writing the journal block
for b2 in transaction T2 but before updating the actual block b1 of
transaction T1, then the system will lose its data integrity. Will this
situation ever occur in ext3 ?

thanks,
Vijayan




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]