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


Groups > linux.kernel > #1654411

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

From "Darrick J. Wong" <darrick.wong@oracle.com>
Newsgroups linux.kernel
Subject Re: [PATCH 07/28] ext4: call journal revoke when freeing ea_inode blocks
Date 2017-05-31 18:20 +0200
Message-ID <tNevM-77a-27@gated-at.bofh.it> (permalink)
References <tN71f-2f2-7@gated-at.bofh.it> <tN7kC-2mN-21@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


On Wed, May 31, 2017 at 01:14:56AM -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>
> ---
>  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))

I appreciate the thoroughness of doing this even for blockmapped
ea_inode files, and I'm not complaining about this hunk at all. :)

However, please consider requiring the extents feature + format as a
prerequisite for ea_inodes.  ext4 has traditionally been very ...
permissive about supporting a diverse range of feature options, but the
cost of that diversity is that the feature support matrix that the
community has to support is already untestably large.

I think it would be wise not to support !extents && ea_inode,
particularly since blockmaps aren't protected by metadata_csum and so in
the long run it's probably best to minimize the introduction of new
blockmap files (on ext4 anyway).

--D

>  		flags |= EXT4_FREE_BLOCKS_FORGET | EXT4_FREE_BLOCKS_METADATA;
>  	else if (ext4_should_journal_data(inode))
>  		flags |= EXT4_FREE_BLOCKS_FORGET;
> -- 
> 2.13.0.219.gdb65acc882-goog
> 

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH 01/28] ext4: xattr-in-inode support Tahsin Erdogan <tahsin@google.com> - 2017-05-31 10:20 +0200
  [PATCH 05/28] ext4: attach jinode after creation of xattr inode Tahsin Erdogan <tahsin@google.com> - 2017-05-31 10:20 +0200
  [PATCH 08/28] ext4: fix ref counting for ea_inode Tahsin Erdogan <tahsin@google.com> - 2017-05-31 10:20 +0200
  [PATCH 25/28] ext4: add ext4_is_quota_file() Tahsin Erdogan <tahsin@google.com> - 2017-05-31 10:30 +0200
  [PATCH 15/28] ext4: fix ext4_xattr_move_to_block() Tahsin Erdogan <tahsin@google.com> - 2017-05-31 10:30 +0200
  [PATCH 24/28] ext4: rename mb block cache functions Tahsin Erdogan <tahsin@google.com> - 2017-05-31 10:30 +0200
  [PATCH 21/28] ext4: modify ext4_xattr_ino_array to hold struct inode * Tahsin Erdogan <tahsin@google.com> - 2017-05-31 10:30 +0200
  [PATCH 23/28] mbcache: make mbcache more generic Tahsin Erdogan <tahsin@google.com> - 2017-05-31 10:30 +0200
  [PATCH 13/28] ext4: ext4_xattr_value_same() should return false for external data Tahsin Erdogan <tahsin@google.com> - 2017-05-31 10:30 +0200
  [PATCH 11/28] ext4: clean up ext4_xattr_inode_get() Tahsin Erdogan <tahsin@google.com> - 2017-05-31 10:30 +0200
  [PATCH 12/28] ext4: add missing le32_to_cpu(e_value_inum) conversions Tahsin Erdogan <tahsin@google.com> - 2017-05-31 10:30 +0200
  [PATCH 20/28] ext4: improve journal credit handling in set xattr paths Tahsin Erdogan <tahsin@google.com> - 2017-05-31 10:30 +0200
  [PATCH 19/28] ext4: ext4_xattr_delete_inode() should return accurate errors Tahsin Erdogan <tahsin@google.com> - 2017-05-31 10:30 +0200
  [PATCH 14/28] ext4: fix ext4_xattr_make_inode_space() value size calculation Tahsin Erdogan <tahsin@google.com> - 2017-05-31 10:30 +0200
  [PATCH 16/28] ext4: fix ext4_xattr_cmp() Tahsin Erdogan <tahsin@google.com> - 2017-05-31 10:30 +0200
  [PATCH 10/28] ext4: change ext4_xattr_inode_iget() signature Tahsin Erdogan <tahsin@google.com> - 2017-05-31 10:40 +0200
  [PATCH 04/28] ext4: do not set posix acls on xattr inodes Tahsin Erdogan <tahsin@google.com> - 2017-05-31 10:40 +0200
  [PATCH 07/28] ext4: call journal revoke when freeing ea_inode blocks Tahsin Erdogan <tahsin@google.com> - 2017-05-31 10:40 +0200
    Re: [PATCH 07/28] ext4: call journal revoke when freeing ea_inode  blocks "Darrick J. Wong" <darrick.wong@oracle.com> - 2017-05-31 18:20 +0200
      Re: [PATCH 07/28] ext4: call journal revoke when freeing ea_inode blocks Tahsin Erdogan <tahsin@google.com> - 2017-05-31 23:10 +0200
      Re: [PATCH 07/28] ext4: call journal revoke when freeing ea_inode  blocks Andreas Dilger <adilger@dilger.ca> - 2017-06-06 00:10 +0200
  [PATCH 09/28] ext4: extended attribute value size limit is enforced by vfs Tahsin Erdogan <tahsin@google.com> - 2017-05-31 10:40 +0200
    Re: [PATCH 09/28] ext4: extended attribute value size limit is  enforced by vfs "Darrick J. Wong" <darrick.wong@oracle.com> - 2017-05-31 18:10 +0200
      Re: [PATCH 09/28] ext4: extended attribute value size limit is  enforced by vfs Tahsin Erdogan <tahsin@google.com> - 2017-05-31 18:20 +0200
  [PATCH 06/28] ext4: ea_inode owner should be the same as the inode owner Tahsin Erdogan <tahsin@google.com> - 2017-05-31 10:40 +0200
  Re: [PATCH 01/28] ext4: xattr-in-inode support "Darrick J. Wong" <darrick.wong@oracle.com> - 2017-05-31 18:50 +0200
    Re: [PATCH 01/28] ext4: xattr-in-inode support Tahsin Erdogan <tahsin@google.com> - 2017-05-31 22:10 +0200
      [PATCH v2 01/28] ext4: xattr-in-inode support Tahsin Erdogan <tahsin@google.com> - 2017-06-01 18:00 +0200

csiph-web