Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1672040 > unrolled thread

[PATCH 07/32] ext4: call journal revoke when freeing ea_inode blocks

Started byTahsin Erdogan <tahsin@google.com>
First post2017-06-21 23:30 +0200
Last post2017-06-22 03:40 +0200
Articles 2 — 2 participants

Back to article view | Back to linux.kernel

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  [PATCH 07/32] ext4: call journal revoke when freeing ea_inode blocks Tahsin Erdogan <tahsin@google.com> - 2017-06-21 23:30 +0200
    Re: [PATCH 07/32] ext4: call journal revoke when freeing ea_inode  blocks Theodore Ts'o <tytso@mit.edu> - 2017-06-22 03:40 +0200

#1672040 — [PATCH 07/32] ext4: call journal revoke when freeing ea_inode blocks

FromTahsin Erdogan <tahsin@google.com>
Date2017-06-21 23:30 +0200
Subject[PATCH 07/32] ext4: call journal revoke when freeing ea_inode blocks
Message-ID<tUVmi-3od-7@gated-at.bofh.it>
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>
---
 fs/ext4/extents.c  | 3 ++-
 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)
 
 static inline int get_default_free_blocks_flags(struct inode *inode)
 {
-	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))
 		return EXT4_FREE_BLOCKS_METADATA | EXT4_FREE_BLOCKS_FORGET;
 	else if (ext4_should_journal_data(inode))
 		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,
 	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;
-- 
2.13.1.611.g7e3b11ae1-goog

[toc] | [next] | [standalone]


#1672204 — Re: [PATCH 07/32] ext4: call journal revoke when freeing ea_inode blocks

FromTheodore Ts'o <tytso@mit.edu>
Date2017-06-22 03:40 +0200
SubjectRe: [PATCH 07/32] ext4: call journal revoke when freeing ea_inode blocks
Message-ID<tUZgd-644-3@gated-at.bofh.it>
In reply to#1672040
On Wed, Jun 21, 2017 at 02:21:17PM -0700, Tahsin Erdogan wrote:
> 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>

Thanks, applied.

						- Ted

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web