summaryrefslogtreecommitdiffstats
path: root/fs/ext4/indirect.c
diff options
context:
space:
mode:
authorTahsin Erdogan <tahsin@google.com>2017-06-22 03:36:51 +0200
committerTheodore Ts'o <tytso@mit.edu>2017-06-22 03:36:51 +0200
commitddfa17e4adc4bd19c32216aaa6250dc38b0579df (patch)
treedd98d6850e32b6998c97b44d157f0a8d2ce5dc40 /fs/ext4/indirect.c
parentext4: ea_inode owner should be the same as the inode owner (diff)
downloadlinux-ddfa17e4adc4bd19c32216aaa6250dc38b0579df.tar.xz
linux-ddfa17e4adc4bd19c32216aaa6250dc38b0579df.zip
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>
Diffstat (limited to 'fs/ext4/indirect.c')
-rw-r--r--fs/ext4/indirect.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/fs/ext4/indirect.c b/fs/ext4/indirect.c
index bc15c2c17633..7ffa290cbb8e 100644
--- a/fs/ext4/indirect.c
+++ b/fs/ext4/indirect.c
@@ -829,7 +829,8 @@ static int ext4_clear_blocks(handle_t *handle, struct inode *inode,
int flags = EXT4_FREE_BLOCKS_VALIDATED;
int err;
- if (S_ISDIR(inode->i_mode) || S_ISLNK(inode->i_mode))
+ if (S_ISDIR(inode->i_mode) || S_ISLNK(inode->i_mode) ||
+ ext4_test_inode_flag(inode, EXT4_INODE_EA_INODE))
flags |= EXT4_FREE_BLOCKS_FORGET | EXT4_FREE_BLOCKS_METADATA;
else if (ext4_should_journal_data(inode))
flags |= EXT4_FREE_BLOCKS_FORGET;