ext3 Bug in 2.4.20

kwall@kurtwerks.com kwall
Mon May 17 11:41:02 PDT 2004


Eew. Just when I thought I liked ext3:

-----
From: Andrew Morton
To: linux-kernel Mailing List
Subject: data corrupting bug in 2.4.20 ext3, data=journal
Date: Sun Dec 01 2002 - 03:11:41 EST

In 2.4.20-pre5 an optimisation was made to the ext3 fsync function
which can very easily cause file data corruption at unmount time. This
was first reported by Nick Piggin on November 29th (one day after 2.4.20 was
released, and three months after the bug was merged. Unfortunate timing)

This only affects filesystems which were mounted with the `data=journal'
option. Or files which are operating under `chattr -j'. So most people
are unaffected. The problem is not present in 2.5 kernels.
The symptoms are that any file data which was written within the thirty
seconds prior to the unmount may not make it to disk. A workaround
is to run `sync' before nmounting.

The optimisation was intended to avoid writing out and waiting on the
inode's buffers when the subsequent commit would do that anyway. This
optimisation was applied to both data=journal and data=ordered modes.
But it is only valid for data=ordered mode.

In data=journal mode the data is left dirty in memory and the unmount
will silently discard it.
-----

A posted patch didn't fix the problem. So, don't use "data=journal"
mode. The default is "data=ordered" mode, but I'm still distressed.
Fortunately, I'm at 2.4.20-pre3 and didn't roll the 2.4.20 bits when
they were released. Looks like 2.4.21 can't be far behind. ;-)

Kurt
-- 
Westheimer's Discovery:
	A couple of months in the laboratory can frequently save a
couple of hours in the library.


More information about the Linux-users mailing list