From: Baokun Li <libaokun1@huawei.com>
To: Theodore Ts'o <tytso@mit.edu>, Ojaswin Mujoo <ojaswin@linux.ibm.com>
Cc: <linux-ext4@vger.kernel.org>, Jan Kara <jack@suse.cz>,
Ritesh Harjani <ritesh.list@gmail.com>,
<linux-kernel@vger.kernel.org>, Yang Erkun <yangerkun@huawei.com>
Subject: Re: [PATCH] ext4: cache es->s_journal_inum in ext4_sb_info
Date: Mon, 17 Mar 2025 11:54:32 +0800 [thread overview]
Message-ID: <4918d461-e507-451e-beee-a7de2884c45b@huawei.com> (raw)
In-Reply-To: <20250316014128.GA787758@mit.edu>
On 2025/3/16 9:41, Theodore Ts'o wrote:
> 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
>
This looks good!
It's a much more direct approach, avoiding extra field and complex code.
Cheers,
Baokun
next prev parent reply other threads:[~2025-03-17 3:54 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
2025-03-17 3:54 ` Baokun Li [this message]
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=4918d461-e507-451e-beee-a7de2884c45b@huawei.com \
--to=libaokun1@huawei.com \
--cc=jack@suse.cz \
--cc=linux-ext4@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=ojaswin@linux.ibm.com \
--cc=ritesh.list@gmail.com \
--cc=tytso@mit.edu \
--cc=yangerkun@huawei.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.