public inbox for linux-ext4@vger.kernel.org
 help / color / mirror / Atom feed
From: "Theodore Ts'o" <tytso@mit.edu>
To: Ojaswin Mujoo <ojaswin@linux.ibm.com>
Cc: linux-ext4@vger.kernel.org, Jan Kara <jack@suse.cz>,
	Baokun Li <libaokun1@huawei.com>,
	Ritesh Harjani <ritesh.list@gmail.com>,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH] ext4: cache es->s_journal_inum in ext4_sb_info
Date: Sat, 15 Mar 2025 21:41:28 -0400	[thread overview]
Message-ID: <20250316014128.GA787758@mit.edu> (raw)
In-Reply-To: <d1a9328a41029f6210a1924b192a59afcd3c5cee.1741952406.git.ojaswin@linux.ibm.com>

On Fri, Mar 14, 2025 at 05:11:43PM +0530, Ojaswin Mujoo wrote:
> Currently, we access journal ino through sbi->s_es->s_journal_inum,
> which directly reads from the ext4 sb buffer head. If someone modifies
> this underneath us then the s_journal_inum field might get corrupted.
> 
> Although direct block device modifications can be expected to cause
> issues in the FS, let's cache s_journal_inum in sbi->s_journal_ino so
> our checks can be more resillient.

The reason why the block validity checks need to check against
s_journal_ino is to exempt the lookups done by ext4_journal_bmap()
from running afoul of the system zone checks, since the journal's data
blocks are considered part of the system zone.

So this is something we need to do if the journal is actived, and if
it's active, then sbi->s_journal will be non-NULL, and so we can just
check to see if inode == sbi->s_journal instead.  This will simplify
the code, without needing to expand the ext4_sb_info structure.

Cheers,

						- Ted

  parent reply	other threads:[~2025-03-16  1:41 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-03-14 11:41 [PATCH] ext4: cache es->s_journal_inum in ext4_sb_info Ojaswin Mujoo
2025-03-15  7:19 ` Zhang Yi
2025-03-16  1:41 ` Theodore Ts'o [this message]
2025-03-17  3:54   ` Baokun Li
2025-03-18  8:12   ` Ojaswin Mujoo
2025-03-19  2:31     ` Theodore Ts'o
2025-03-25 17:57       ` Ojaswin Mujoo
2025-03-26  2:16         ` Baokun Li
2025-03-26  4:01           ` Zhang Yi
2025-03-26  6:39             ` Ojaswin Mujoo
2025-03-26  8:33               ` Zhang Yi
2025-03-26  9:26                 ` Baokun Li
2025-03-27  6:20                   ` Ojaswin Mujoo

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20250316014128.GA787758@mit.edu \
    --to=tytso@mit.edu \
    --cc=jack@suse.cz \
    --cc=libaokun1@huawei.com \
    --cc=linux-ext4@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=ojaswin@linux.ibm.com \
    --cc=ritesh.list@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox