Commit beb37b85 authored by Jan Kara's avatar Jan Kara

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: default avatarAndreas Dilger <adilger.kernel@dilger.ca>
Signed-off-by: default avatarJan Kara <jack@suse.cz>
parent 80f44b15
...@@ -570,9 +570,14 @@ struct inode *ext3_new_inode(handle_t *handle, struct inode * dir, int mode) ...@@ -570,9 +570,14 @@ struct inode *ext3_new_inode(handle_t *handle, struct inode * dir, int mode)
ei->i_state_flags = 0; ei->i_state_flags = 0;
ext3_set_inode_state(inode, EXT3_STATE_NEW); ext3_set_inode_state(inode, EXT3_STATE_NEW);
ei->i_extra_isize = /* See comment in ext3_iget for explanation */
(EXT3_INODE_SIZE(inode->i_sb) > EXT3_GOOD_OLD_INODE_SIZE) ? if (ino >= EXT3_FIRST_INO(sb) + 1 &&
sizeof(struct ext3_inode) - EXT3_GOOD_OLD_INODE_SIZE : 0; EXT3_INODE_SIZE(sb) > EXT3_GOOD_OLD_INODE_SIZE) {
ei->i_extra_isize =
sizeof(struct ext3_inode) - EXT3_GOOD_OLD_INODE_SIZE;
} else {
ei->i_extra_isize = 0;
}
ret = inode; ret = inode;
dquot_initialize(inode); dquot_initialize(inode);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment