[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <4918d461-e507-451e-beee-a7de2884c45b@huawei.com>
Date: Mon, 17 Mar 2025 11:54:32 +0800
From: Baokun Li <libaokun1@...wei.com>
To: Theodore Ts'o <tytso@....edu>, Ojaswin Mujoo <ojaswin@...ux.ibm.com>
CC: <linux-ext4@...r.kernel.org>, Jan Kara <jack@...e.cz>, Ritesh Harjani
<ritesh.list@...il.com>, <linux-kernel@...r.kernel.org>, Yang Erkun
<yangerkun@...wei.com>
Subject: Re: [PATCH] ext4: cache es->s_journal_inum in ext4_sb_info
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
Powered by blists - more mailing lists