From: Christoph Hellwig <hch@infradead.org>
To: Eric Sandeen <sandeen@sandeen.net>
Cc: bodonnel@redhat.com, linux-xfs@vger.kernel.org, djwong@kernel.org
Subject: Re: [PATCH] xfs_repair: handling a block with bad crc, bad uuid, and bad magic number needs fixing
Date: Fri, 21 Mar 2025 00:35:22 -0700 [thread overview]
Message-ID: <Z90WuvYsuAxQVjEW@infradead.org> (raw)
In-Reply-To: <2692c652-bb23-4a5f-be74-bbcea4a91827@sandeen.net>
On Thu, Mar 20, 2025 at 06:28:19PM -0500, Eric Sandeen wrote:
> > - be32_to_cpu(d->magic) == XFS_DIR3_DATA_MAGIC) {
> > + if (xfs_has_crc(mp))
> > + wantmagic = XFS_DIR3_BLOCK_MAGIC;
> > + else
> > + wantmagic = XFS_DIR2_BLOCK_MAGIC;
> > + if (wantmagic == XFS_DIR3_BLOCK_MAGIC) {
>
> So I guess the prior 5 lines are equivalent to:
>
> /* check v5 metadata */
> if (xfs_has_crc(mp)) {
> ...
>
> and that will force it to check the header, below. And then I think we hit
> the goto out_fix; line, and it moves the contents of this directory to
> lost+found (at least on my custom repro image.)
>
> Curious to see what others think is the right path through all this.
I'll need some time to actually understand the code, but replacing the
wantmagic logic with just doign the xfs_has_crc check looks right and
muche easier to follow.
prev parent reply other threads:[~2025-03-21 7:35 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-03-20 20:25 [PATCH] xfs_repair: handling a block with bad crc, bad uuid, and bad magic number needs fixing bodonnel
2025-03-20 22:21 ` Eric Sandeen
2025-03-21 7:32 ` Christoph Hellwig
2025-03-20 23:28 ` Eric Sandeen
2025-03-21 7:35 ` Christoph Hellwig [this message]
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=Z90WuvYsuAxQVjEW@infradead.org \
--to=hch@infradead.org \
--cc=bodonnel@redhat.com \
--cc=djwong@kernel.org \
--cc=linux-xfs@vger.kernel.org \
--cc=sandeen@sandeen.net \
/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