diff mbox series

[v4,1/3] ext4: don't increase iversion counter for ea_inodes

Message ID 20220824160349.39664-1-lczerner@redhat.com (mailing list archive)
State New, archived
Headers show
Series [v4,1/3] ext4: don't increase iversion counter for ea_inodes | expand

Commit Message

Lukas Czerner Aug. 24, 2022, 4:03 p.m. UTC
ea_inodes are using i_version for storing part of the reference count so
we really need to leave it alone.

The problem can be reproduced by xfstest ext4/026 when iversion is
enabled. Fix it by not calling inode_inc_iversion() for EXT4_EA_INODE_FL
inodes in ext4_mark_iloc_dirty().

Signed-off-by: Lukas Czerner <lczerner@redhat.com>
Reviewed-by: Jan Kara <jack@suse.cz>
Reviewed-by: Jeff Layton <jlayton@kernel.org>
Reviewed-by: Christian Brauner (Microsoft) <brauner@kernel.org>
---
v2, v3, v4: no change

 fs/ext4/inode.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

Comments

Theodore Ts'o Sept. 29, 2022, 2:58 p.m. UTC | #1
On Wed, 24 Aug 2022 18:03:47 +0200, Lukas Czerner wrote:
> ea_inodes are using i_version for storing part of the reference count so
> we really need to leave it alone.
> 
> The problem can be reproduced by xfstest ext4/026 when iversion is
> enabled. Fix it by not calling inode_inc_iversion() for EXT4_EA_INODE_FL
> inodes in ext4_mark_iloc_dirty().
> 
> [...]

Applied, thanks!

[1/3] ext4: don't increase iversion counter for ea_inodes
      commit: 6c7c5ade428cc65b58e4aba1925b5347970f4456
[2/3] fs: record I_DIRTY_TIME even if inode already has I_DIRTY_INODE
      commit: 625e1e67b66245b93ccae868cd4a950d257de003
[3/3] ext4: unconditionally enable the i_version counter
      commit: 59772a0cb09a7ec77362653e8be207a464fa04af

Best regards,
diff mbox series

Patch

diff --git a/fs/ext4/inode.c b/fs/ext4/inode.c
index 601214453c3a..2a220be34caa 100644
--- a/fs/ext4/inode.c
+++ b/fs/ext4/inode.c
@@ -5731,7 +5731,12 @@  int ext4_mark_iloc_dirty(handle_t *handle,
 	}
 	ext4_fc_track_inode(handle, inode);
 
-	if (IS_I_VERSION(inode))
+	/*
+	 * ea_inodes are using i_version for storing reference count, don't
+	 * mess with it
+	 */
+	if (IS_I_VERSION(inode) &&
+	    !(EXT4_I(inode)->i_flags & EXT4_EA_INODE_FL))
 		inode_inc_iversion(inode);
 
 	/* the do_update_inode consumes one bh->b_count */