diff options
author | Jan Kara <jack@suse.cz> | 2010-08-25 18:54:39 -0400 |
---|---|---|
committer | Jan Kara <jack@suse.cz> | 2010-10-05 06:20:23 -0400 |
commit | beb37b85b0b727e68e16a39a1e5a2140f87fa201 (patch) | |
tree | fa09390f90a604ce55edf61ca3c1377deff283a5 /fs/ext3 | |
parent | 80f44b152c889e592616adf0d33b856107f4bace (diff) |
ext3: Fix lost extented attributes for inode with ino == 11
If a filesystem has inode size > 128 and someone deletes lost+found and
reuses inode 11 for some other file, extented attributes set for this
inode before umount will get lost after remounting the filesystem. This
is because extended attributes will get stored in an inode but ext3_iget
will ignore them due to workaround of a bug in an old mkfs.
Fix the problem by initializing i_extra_isize to 0 for freshly allocated
inodes where mkfs workaround in ext3_iget applies. This way these inodes
will always store extended attributes in a special block and no problems
occur.
The bug was spotted and a reproduction test provided by:
Masayoshi MIZUMA <m.mizuma@jp.fujitsu.com>
Reviewed-by: Andreas Dilger <adilger.kernel@dilger.ca>
Signed-off-by: Jan Kara <jack@suse.cz>
Diffstat (limited to 'fs/ext3')
-rw-r--r-- | fs/ext3/ialloc.c | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/fs/ext3/ialloc.c b/fs/ext3/ialloc.c index 4ab72db3559e..9724aef22460 100644 --- a/fs/ext3/ialloc.c +++ b/fs/ext3/ialloc.c | |||
@@ -570,9 +570,14 @@ got: | |||
570 | ei->i_state_flags = 0; | 570 | ei->i_state_flags = 0; |
571 | ext3_set_inode_state(inode, EXT3_STATE_NEW); | 571 | ext3_set_inode_state(inode, EXT3_STATE_NEW); |
572 | 572 | ||
573 | ei->i_extra_isize = | 573 | /* See comment in ext3_iget for explanation */ |
574 | (EXT3_INODE_SIZE(inode->i_sb) > EXT3_GOOD_OLD_INODE_SIZE) ? | 574 | if (ino >= EXT3_FIRST_INO(sb) + 1 && |
575 | sizeof(struct ext3_inode) - EXT3_GOOD_OLD_INODE_SIZE : 0; | 575 | EXT3_INODE_SIZE(sb) > EXT3_GOOD_OLD_INODE_SIZE) { |
576 | ei->i_extra_isize = | ||
577 | sizeof(struct ext3_inode) - EXT3_GOOD_OLD_INODE_SIZE; | ||
578 | } else { | ||
579 | ei->i_extra_isize = 0; | ||
580 | } | ||
576 | 581 | ||
577 | ret = inode; | 582 | ret = inode; |
578 | dquot_initialize(inode); | 583 | dquot_initialize(inode); |