2
0
mirror of https://github.com/edk2-porting/linux-next.git synced 2024-12-15 08:44:14 +08:00
linux-next/fs/ext2
Bernard Blackham e072c6f2af [PATCH] ext2 corruption - regression between 2.6.9 and 2.6.10
Whilst trying to stress test a Promise SX8 card, we stumbled across
some nasty filesystem corruption in ext2. Our tests involved
creating an ext2 partition, mounting, running several concurrent
fsx's over it, umounting, and fsck'ing, all scripted[1]. The fsck
would always return with errors.

This regression was traced back to a change between 2.6.9 and
2.6.10, which moves the functionality of ext2_put_inode into
ext2_clear_inode.  The attached patch reverses this change, and
eliminated the source of corruption.

Mingming Cao <cmm@us.ibm.com> said:

I think his patch for ext2 is correct.  The corruption on ext3 is not the same
issue he saw on ext2.  I believe that's the race between discard reservation
and reservation in-use that we already fixed it in 2.6.12- rc1.

For the problem related to ext2, at the time when we design reservation for
ext3, we decide we only need to discard the reservation at the last file
close, so we have ext3_discard_reservation on iput_final- >ext3_clear_inode.

The ext2 handle discard preallocation differently at that time, it discard the
preallocation at each iput(), not in input_final(), so we think it's
unnecessary to thrash it so frequently, and the right thing to do, as we did
for ext3 reservation, discard preallocation on last iput().  So we moved the
ext2_discard_preallocation from ext2_put_inode(0 to ext2_clear_inode.

Since ext2 preallocation is doing pre-allocation on disk, so it is possible
that at the unmount time, someone is still hold the reference of the inode, so
the preallocation for a file is not discard yet, so we still mark those blocks
allocated on disk, while they are not actually in the inode's block map, so
fsck will catch/fix that error later.

This is not a issue for ext3, as ext3 reservation(pre-allocation) is done in
memory.

Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2005-04-16 15:25:45 -07:00
..
acl.c [PATCH] Fix acl Oops 2005-04-16 15:24:00 -07:00
acl.h Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
balloc.c Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
bitmap.c Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
CHANGES Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
dir.c Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
ext2.h [PATCH] ext2 corruption - regression between 2.6.9 and 2.6.10 2005-04-16 15:25:45 -07:00
file.c Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
fsync.c Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
ialloc.c Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
inode.c [PATCH] ext2 corruption - regression between 2.6.9 and 2.6.10 2005-04-16 15:25:45 -07:00
ioctl.c Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
Makefile Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
namei.c Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
super.c [PATCH] ext2 corruption - regression between 2.6.9 and 2.6.10 2005-04-16 15:25:45 -07:00
symlink.c Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
xattr_security.c Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
xattr_trusted.c Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
xattr_user.c Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
xattr.c Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
xattr.h Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00