[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20251125170624.GA23380@frogsfrogsfrogs>
Date: Tue, 25 Nov 2025 09:06:24 -0800
From: "Darrick J. Wong" <djwong@...nel.org>
To: Christoph Hellwig <hch@...radead.org>
Cc: Raphael Pinsonneault-Thibeault <rpthibeault@...il.com>, cem@...nel.org,
chandanbabu@...nel.org, bfoster@...hat.com, david@...morbit.com,
linux-xfs@...r.kernel.org, linux-kernel@...r.kernel.org,
linux-kernel-mentees@...ts.linux.dev,
syzbot+9f6d080dece587cfdd4c@...kaller.appspotmail.com
Subject: Re: [PATCH v5] xfs: validate log record version against superblock
log version
On Mon, Nov 24, 2025 at 10:31:22PM -0800, Christoph Hellwig wrote:
> > Hrmm maybe we ought to reserve XLOG_VERSION==0x3 so that whenever we do
> > log v3 we don't accidentally write logs with bits that won't be
> > validated quite right on old kernels?
>
> Why do we need to reserve that? The code checks for either 1 or 2
> right now based on the log feature flag. If we add a v3 log we'll
> have to ammend this, but reservations won't help with that.
Yeah, I suppose you're right -- log v3 will require a new sb feature
bit, and that's good enough.
--D
> > > + if (xfs_has_logv2(mp)) {
> > > + if (XFS_IS_CORRUPT(mp, h_version != XLOG_VERSION_2))
> >
> > Being pedantic here, but the kernel cpu_to_be32 wrappers are magic in
> > that they compile to byteswapped constants so you can avoid the runtime
> > overhead of byteswapping rhead->h_version by doing:
> >
> > if (XFS_IS_CORRUPT(mp,
> > rhead->h_version != cpu_to_be32(XLOG_VERSION_2)))
> > return -EFSCORRUPTED;
> >
> > But seeing as this is log validation for recovery, I think the
> > performance implications are vanishingly small.
>
> Yes.
>
>
Powered by blists - more mailing lists