Skip to content

Commit ddfa17e

Browse files
Tahsin Erdogantytso
authored andcommitted
ext4: call journal revoke when freeing ea_inode blocks
ea_inode contents are treated as metadata, that's why it is journaled during initial writes. Failing to call revoke during freeing could cause user data to be overwritten with original ea_inode contents during journal replay. Signed-off-by: Tahsin Erdogan <tahsin@google.com> Signed-off-by: Theodore Ts'o <tytso@mit.edu>
1 parent 9e1ba00 commit ddfa17e

2 files changed

Lines changed: 4 additions & 2 deletions

File tree

‎fs/ext4/extents.c‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2488,7 +2488,8 @@ int ext4_ext_index_trans_blocks(struct inode *inode, int extents)
24882488

24892489
static inline int get_default_free_blocks_flags(struct inode *inode)
24902490
{
2491-
if (S_ISDIR(inode->i_mode) || S_ISLNK(inode->i_mode))
2491+
if (S_ISDIR(inode->i_mode) || S_ISLNK(inode->i_mode) ||
2492+
ext4_test_inode_flag(inode, EXT4_INODE_EA_INODE))
24922493
return EXT4_FREE_BLOCKS_METADATA | EXT4_FREE_BLOCKS_FORGET;
24932494
else if (ext4_should_journal_data(inode))
24942495
return EXT4_FREE_BLOCKS_FORGET;

‎fs/ext4/indirect.c‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -829,7 +829,8 @@ static int ext4_clear_blocks(handle_t *handle, struct inode *inode,
829829
int flags = EXT4_FREE_BLOCKS_VALIDATED;
830830
int err;
831831

832-
if (S_ISDIR(inode->i_mode) || S_ISLNK(inode->i_mode))
832+
if (S_ISDIR(inode->i_mode) || S_ISLNK(inode->i_mode) ||
833+
ext4_test_inode_flag(inode, EXT4_INODE_EA_INODE))
833834
flags |= EXT4_FREE_BLOCKS_FORGET | EXT4_FREE_BLOCKS_METADATA;
834835
else if (ext4_should_journal_data(inode))
835836
flags |= EXT4_FREE_BLOCKS_FORGET;

0 commit comments

Comments
 (0)