linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] ext4: eliminate bogus error in ext4_data_block_valid_rcu()
@ 2021-07-03 23:05 Tahsin Erdogan
  2021-07-04  0:58 ` Theodore Ts'o
  0 siblings, 1 reply; 4+ messages in thread
From: Tahsin Erdogan @ 2021-07-03 23:05 UTC (permalink / raw)
  To: Jan Kara, Greg Kroah-Hartman
  Cc: Tahsin Erdogan, stable, Theodore Ts'o, Andreas Dilger,
	linux-ext4, linux-kernel

Mainline commit ce9f24cccdc0 ("ext4: check journal inode extents more carefully")
enabled validity checks for journal inode's data blocks. This change got
ported to stable branches, but the backport for 4.19 has a bug where it will
flag an error even when system block entry's inode number matches journal
inode.

The way error is reported is also problematic because it updates the superblock
without following journaling rules. This may result in superblock checksum
errors if the superblock is in the process of being committed but has a
previously calculated checksum that doesn't include the bogus error update.

This patch eliminates the bogus error by trying to match how other backports
were implemented, which is to flag an error only when inode numbers mismatch.

Fixes: commit a75a5d163857 ("ext4: check journal inode extents more carefully")
Signed-off-by: Tahsin Erdogan <trdgn@amazon.com>
Cc: stable@vger.kernel.org
Cc: Jan Kara <jack@suse.cz>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
 fs/ext4/block_validity.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/fs/ext4/block_validity.c b/fs/ext4/block_validity.c
index 1ea8fc9ff048..1bc65ecd4bd6 100644
--- a/fs/ext4/block_validity.c
+++ b/fs/ext4/block_validity.c
@@ -171,8 +171,10 @@ static int ext4_data_block_valid_rcu(struct ext4_sb_info *sbi,
 		else if (start_blk >= (entry->start_blk + entry->count))
 			n = n->rb_right;
 		else {
+			if (entry->ino == ino)
+				return 1;
 			sbi->s_es->s_last_error_block = cpu_to_le64(start_blk);
-			return entry->ino == ino;
+			return 0;
 		}
 	}
 	return 1;
-- 
2.17.1


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

* Re: [PATCH] ext4: eliminate bogus error in ext4_data_block_valid_rcu()
  2021-07-03 23:05 [PATCH] ext4: eliminate bogus error in ext4_data_block_valid_rcu() Tahsin Erdogan
@ 2021-07-04  0:58 ` Theodore Ts'o
  2021-07-04  1:35   ` [PATCH 4.19] " Erdogan, Tahsin
  0 siblings, 1 reply; 4+ messages in thread
From: Theodore Ts'o @ 2021-07-04  0:58 UTC (permalink / raw)
  To: Tahsin Erdogan
  Cc: Jan Kara, Greg Kroah-Hartman, stable, Andreas Dilger, linux-ext4,
	linux-kernel

On Sat, Jul 03, 2021 at 04:05:55PM -0700, Tahsin Erdogan wrote:
> Mainline commit ce9f24cccdc0 ("ext4: check journal inode extents more carefully")
> enabled validity checks for journal inode's data blocks. This change got
> ported to stable branches, but the backport for 4.19 has a bug where it will
> flag an error even when system block entry's inode number matches journal
> inode.

Tahsin,

If I understand the commit description, this patch is only intended
for the 4.19 stable kernel.  If this is the case, I'd suggest using
the Subject prefix [PATCH 4.19] for future patches.  This is more
likely to be clearer (via a quick glance at the Subject line) for
subsystem maintainers, as well as for stable kernel maintainers, that
this is meant for the stable kernel.  It would perhaps also be useful
if you could indicate whether a similar fix is needed for 4.14, and
other older LTS kernels, or whether the only stable backport which had
this bug was 4.19.

Cheers,

					- Ted

P.S.  Great to see you've landed at Amazon!  It's been a while; if I
have a chance to make it out to Seattle, one of these days, it would
be great to catch up.

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

* RE: [PATCH 4.19] ext4: eliminate bogus error in ext4_data_block_valid_rcu()
  2021-07-04  0:58 ` Theodore Ts'o
@ 2021-07-04  1:35   ` Erdogan, Tahsin
  2021-07-05  7:06     ` Greg Kroah-Hartman
  0 siblings, 1 reply; 4+ messages in thread
From: Erdogan, Tahsin @ 2021-07-04  1:35 UTC (permalink / raw)
  To: Theodore Ts'o
  Cc: Jan Kara, Greg Kroah-Hartman, stable, Andreas Dilger, linux-ext4,
	linux-kernel

> If I understand the commit description, this patch is only intended
> for the 4.19 stable kernel.  If this is the case, I'd suggest using
> the Subject prefix [PATCH 4.19] for future patches.  This is more

Hi Ted, yes this is only intended for 4.19. Thanks for the tip on subject line,
I will keep that in mind in the future.

> if you could indicate whether a similar fix is needed for 4.14, and
> other older LTS kernels, or whether the only stable backport which had
> this bug was 4.19.

I have checked 4.4, 4.9, 4.14, 5.8. They all look fine. I believe this problem
only affects 4.19.

> P.S.  Great to see you've landed at Amazon!  It's been a while; if I
> have a chance to make it out to Seattle, one of these days, it would
> be great to catch up.

Absolutely, drop me a note next time you are around Seattle.

thanks
tahsin

________________________________________
From: Theodore Ts'o <tytso@mit.edu>
Sent: Saturday, July 3, 2021 5:58 PM
To: Erdogan, Tahsin
Cc: Jan Kara; Greg Kroah-Hartman; stable@vger.kernel.org; Andreas Dilger; linux-ext4@vger.kernel.org; linux-kernel@vger.kernel.org
Subject: RE: [EXTERNAL] [PATCH] ext4: eliminate bogus error in ext4_data_block_valid_rcu()

CAUTION: This email originated from outside of the organization. Do not click links or open attachments unless you can confirm the sender and know the content is safe.



On Sat, Jul 03, 2021 at 04:05:55PM -0700, Tahsin Erdogan wrote:
> Mainline commit ce9f24cccdc0 ("ext4: check journal inode extents more carefully")
> enabled validity checks for journal inode's data blocks. This change got
> ported to stable branches, but the backport for 4.19 has a bug where it will
> flag an error even when system block entry's inode number matches journal
> inode.

Tahsin,

If I understand the commit description, this patch is only intended
for the 4.19 stable kernel.  If this is the case, I'd suggest using
the Subject prefix [PATCH 4.19] for future patches.  This is more
likely to be clearer (via a quick glance at the Subject line) for
subsystem maintainers, as well as for stable kernel maintainers, that
this is meant for the stable kernel.  It would perhaps also be useful
if you could indicate whether a similar fix is needed for 4.14, and
other older LTS kernels, or whether the only stable backport which had
this bug was 4.19.

Cheers,

                                        - Ted

P.S.  Great to see you've landed at Amazon!  It's been a while; if I
have a chance to make it out to Seattle, one of these days, it would
be great to catch up.

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

* Re: [PATCH 4.19] ext4: eliminate bogus error in ext4_data_block_valid_rcu()
  2021-07-04  1:35   ` [PATCH 4.19] " Erdogan, Tahsin
@ 2021-07-05  7:06     ` Greg Kroah-Hartman
  0 siblings, 0 replies; 4+ messages in thread
From: Greg Kroah-Hartman @ 2021-07-05  7:06 UTC (permalink / raw)
  To: Erdogan, Tahsin
  Cc: Theodore Ts'o, Jan Kara, stable, Andreas Dilger, linux-ext4,
	linux-kernel

On Sun, Jul 04, 2021 at 01:35:09AM +0000, Erdogan, Tahsin wrote:
> > If I understand the commit description, this patch is only intended
> > for the 4.19 stable kernel.  If this is the case, I'd suggest using
> > the Subject prefix [PATCH 4.19] for future patches.  This is more
> 
> Hi Ted, yes this is only intended for 4.19. Thanks for the tip on subject line,
> I will keep that in mind in the future.
> 
> > if you could indicate whether a similar fix is needed for 4.14, and
> > other older LTS kernels, or whether the only stable backport which had
> > this bug was 4.19.
> 
> I have checked 4.4, 4.9, 4.14, 5.8. They all look fine. I believe this problem
> only affects 4.19.

THanks, now queued up.

greg k-h

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

end of thread, other threads:[~2021-07-05  7:06 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-07-03 23:05 [PATCH] ext4: eliminate bogus error in ext4_data_block_valid_rcu() Tahsin Erdogan
2021-07-04  0:58 ` Theodore Ts'o
2021-07-04  1:35   ` [PATCH 4.19] " Erdogan, Tahsin
2021-07-05  7:06     ` Greg Kroah-Hartman

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).