public inbox for linux-ext4@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] ext4: Fix bogus warning in ext4_update_dx_flag()
@ 2020-11-18 15:30 Jan Kara
  2020-11-18 21:53 ` Eric Biggers
  0 siblings, 1 reply; 3+ messages in thread
From: Jan Kara @ 2020-11-18 15:30 UTC (permalink / raw)
  To: Ted Tso; +Cc: linux-ext4, Eric Biggers, Jan Kara

The idea of the warning in ext4_update_dx_flag() is that we should warn
when we are clearing EXT4_INODE_INDEX on a filesystem with metadata
checksums enabled since after clearing the flag, checksums for internal
htree nodes will become invalid. So there's no need to warn (or actually
do anything) when EXT4_INODE_INDEX is not set.

Reported-by: Eric Biggers <ebiggers@kernel.org>
Fixes: 48a34311953d ("ext4: fix checksum errors with indexed dirs")
Signed-off-by: Jan Kara <jack@suse.cz>
---
 fs/ext4/ext4.h | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/fs/ext4/ext4.h b/fs/ext4/ext4.h
index f976b5089476..5ee04ee27769 100644
--- a/fs/ext4/ext4.h
+++ b/fs/ext4/ext4.h
@@ -2685,7 +2685,8 @@ void ext4_insert_dentry(struct inode *inode,
 			struct ext4_filename *fname);
 static inline void ext4_update_dx_flag(struct inode *inode)
 {
-	if (!ext4_has_feature_dir_index(inode->i_sb)) {
+	if (!ext4_has_feature_dir_index(inode->i_sb) &&
+	    ext4_test_inode_flag(inode, EXT4_INODE_INDEX)) {
 		/* ext4_iget() should have caught this... */
 		WARN_ON_ONCE(ext4_has_feature_metadata_csum(inode->i_sb));
 		ext4_clear_inode_flag(inode, EXT4_INODE_INDEX);
-- 
2.16.4


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] ext4: Fix bogus warning in ext4_update_dx_flag()
  2020-11-18 15:30 [PATCH] ext4: Fix bogus warning in ext4_update_dx_flag() Jan Kara
@ 2020-11-18 21:53 ` Eric Biggers
  2020-11-20  3:41   ` Theodore Y. Ts'o
  0 siblings, 1 reply; 3+ messages in thread
From: Eric Biggers @ 2020-11-18 21:53 UTC (permalink / raw)
  To: Jan Kara; +Cc: Ted Tso, linux-ext4

On Wed, Nov 18, 2020 at 04:30:32PM +0100, Jan Kara wrote:
> The idea of the warning in ext4_update_dx_flag() is that we should warn
> when we are clearing EXT4_INODE_INDEX on a filesystem with metadata
> checksums enabled since after clearing the flag, checksums for internal
> htree nodes will become invalid. So there's no need to warn (or actually
> do anything) when EXT4_INODE_INDEX is not set.
> 
> Reported-by: Eric Biggers <ebiggers@kernel.org>
> Fixes: 48a34311953d ("ext4: fix checksum errors with indexed dirs")
> Signed-off-by: Jan Kara <jack@suse.cz>

Looks good,

Reviewed-by: Eric Biggers <ebiggers@google.com>

- Eric

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] ext4: Fix bogus warning in ext4_update_dx_flag()
  2020-11-18 21:53 ` Eric Biggers
@ 2020-11-20  3:41   ` Theodore Y. Ts'o
  0 siblings, 0 replies; 3+ messages in thread
From: Theodore Y. Ts'o @ 2020-11-20  3:41 UTC (permalink / raw)
  To: Eric Biggers; +Cc: Jan Kara, linux-ext4

On Wed, Nov 18, 2020 at 01:53:10PM -0800, Eric Biggers wrote:
> On Wed, Nov 18, 2020 at 04:30:32PM +0100, Jan Kara wrote:
> > The idea of the warning in ext4_update_dx_flag() is that we should warn
> > when we are clearing EXT4_INODE_INDEX on a filesystem with metadata
> > checksums enabled since after clearing the flag, checksums for internal
> > htree nodes will become invalid. So there's no need to warn (or actually
> > do anything) when EXT4_INODE_INDEX is not set.
> > 
> > Reported-by: Eric Biggers <ebiggers@kernel.org>
> > Fixes: 48a34311953d ("ext4: fix checksum errors with indexed dirs")
> > Signed-off-by: Jan Kara <jack@suse.cz>
> 
> Looks good,
> 
> Reviewed-by: Eric Biggers <ebiggers@google.com>

Applied, thanks.

					- Ted

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2020-11-20  3:42 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-11-18 15:30 [PATCH] ext4: Fix bogus warning in ext4_update_dx_flag() Jan Kara
2020-11-18 21:53 ` Eric Biggers
2020-11-20  3:41   ` Theodore Y. Ts'o

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox