Re: scary ext2 filesystem question

Alan Cox (alan@lxorguk.ukuu.org.uk)
Sat, 26 Dec 1998 19:44:25 +0000 (GMT)


> Really, I don't know what to add to this sentence. Without
> implementing partially ordered writes, this is a problem. Now, even
> the author admits that this is "unlikely" to happen, and practical
> experience says that it is at best extremely rare. Still, nothing
> that the author said appears to be FUD or incorrect from what I know.

Bang head on wall time. You need more than partially ordered writes to
solve what you describe. Consider adding a 4K block to a file. You must
write

The inode - new size, block count
The indirect block (maybe blocks) with the block number
The data block.

Now you can order those however you like as strictly as you like I can
still turn the power off at any point.

Ext2fs (generally)
update data block
update inode
update indirect block

So potentially the data update is lost on a power off because the inode
or indirect block isnt written.

BSD (strict)
update inode
update indirect block
update data block

And if I turn the power off your file is 4K larger, consistent with its
meta-data and containing 4K of unspecified random previous data - eg a previous
copy of the shadow password file, a private note to your girlfriend whatever..

You can pick any order of update you like, you still lose. Only a transaction
based file system where you atomically write a transaction, then commit it
is capable of resolving the situation.

Anyone who can't grasp such basic facts shouldnt be writing books on file
systems

Alan

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/