diff options
author | Konstantin Khlebnikov <khlebnikov@yandex-team.ru> | 2017-05-22 05:36:23 +0300 |
---|---|---|
committer | Theodore Ts'o <tytso@mit.edu> | 2017-05-22 05:36:23 +0300 |
commit | 887a9730614727c4fff7cb756711b190593fc1df (patch) | |
tree | 9d208659802a8a11add61a841911a2c7b6d69971 /fs/ext4 | |
parent | 9651e6b2e20648d04d5e1fe6479a3056047e8781 (diff) | |
download | linux-887a9730614727c4fff7cb756711b190593fc1df.tar.xz |
ext4: keep existing extra fields when inode expands
ext4_expand_extra_isize() should clear only space between old and new
size.
Fixes: 6dd4ee7cab7e # v2.6.23
Cc: stable@vger.kernel.org
Signed-off-by: Konstantin Khlebnikov <khlebnikov@yandex-team.ru>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Diffstat (limited to 'fs/ext4')
-rw-r--r-- | fs/ext4/inode.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/fs/ext4/inode.c b/fs/ext4/inode.c index 1bd0bfa547f6..7cd99de8c4ba 100644 --- a/fs/ext4/inode.c +++ b/fs/ext4/inode.c @@ -5637,8 +5637,9 @@ static int ext4_expand_extra_isize(struct inode *inode, /* No extended attributes present */ if (!ext4_test_inode_state(inode, EXT4_STATE_XATTR) || header->h_magic != cpu_to_le32(EXT4_XATTR_MAGIC)) { - memset((void *)raw_inode + EXT4_GOOD_OLD_INODE_SIZE, 0, - new_extra_isize); + memset((void *)raw_inode + EXT4_GOOD_OLD_INODE_SIZE + + EXT4_I(inode)->i_extra_isize, 0, + new_extra_isize - EXT4_I(inode)->i_extra_isize); EXT4_I(inode)->i_extra_isize = new_extra_isize; return 0; } |