diff options
author | Tahsin Erdogan <tahsin@google.com> | 2017-06-21 21:36:51 -0400 |
---|---|---|
committer | Theodore Ts'o <tytso@mit.edu> | 2017-06-21 21:36:51 -0400 |
commit | ddfa17e4adc4bd19c32216aaa6250dc38b0579df (patch) | |
tree | dd98d6850e32b6998c97b44d157f0a8d2ce5dc40 | |
parent | 9e1ba00161a6f3bec8d4e7912025cbf889878e59 (diff) |
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>
-rw-r--r-- | fs/ext4/extents.c | 3 | ||||
-rw-r--r-- | fs/ext4/indirect.c | 3 |
2 files changed, 4 insertions, 2 deletions
diff --git a/fs/ext4/extents.c b/fs/ext4/extents.c index 3e36508610b7..e0a8425ff74d 100644 --- a/fs/ext4/extents.c +++ b/fs/ext4/extents.c | |||
@@ -2488,7 +2488,8 @@ int ext4_ext_index_trans_blocks(struct inode *inode, int extents) | |||
2488 | 2488 | ||
2489 | static inline int get_default_free_blocks_flags(struct inode *inode) | 2489 | static inline int get_default_free_blocks_flags(struct inode *inode) |
2490 | { | 2490 | { |
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)) | ||
2492 | return EXT4_FREE_BLOCKS_METADATA | EXT4_FREE_BLOCKS_FORGET; | 2493 | return EXT4_FREE_BLOCKS_METADATA | EXT4_FREE_BLOCKS_FORGET; |
2493 | else if (ext4_should_journal_data(inode)) | 2494 | else if (ext4_should_journal_data(inode)) |
2494 | return EXT4_FREE_BLOCKS_FORGET; | 2495 | return EXT4_FREE_BLOCKS_FORGET; |
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, | |||
829 | int flags = EXT4_FREE_BLOCKS_VALIDATED; | 829 | int flags = EXT4_FREE_BLOCKS_VALIDATED; |
830 | int err; | 830 | int err; |
831 | 831 | ||
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)) | ||
833 | flags |= EXT4_FREE_BLOCKS_FORGET | EXT4_FREE_BLOCKS_METADATA; | 834 | flags |= EXT4_FREE_BLOCKS_FORGET | EXT4_FREE_BLOCKS_METADATA; |
834 | else if (ext4_should_journal_data(inode)) | 835 | else if (ext4_should_journal_data(inode)) |
835 | flags |= EXT4_FREE_BLOCKS_FORGET; | 836 | flags |= EXT4_FREE_BLOCKS_FORGET; |