From: "Darrick J. Wong" <djwong@kernel.org>
To: Dave Chinner <david@fromorbit.com>
Cc: Eric Sandeen <sandeen@redhat.com>,
sandeen@sandeen.net, linux-xfs@vger.kernel.org
Subject: Re: [PATCH 1/3] xfs_repair: detect v5 featureset mismatches in secondary supers
Date: Mon, 16 May 2022 10:59:42 -0700 [thread overview]
Message-ID: <YoKRDhAgythlT0if@magnolia> (raw)
In-Reply-To: <20220516081153.GO1098723@dread.disaster.area>
On Mon, May 16, 2022 at 06:11:53PM +1000, Dave Chinner wrote:
> On Thu, May 12, 2022 at 12:13:29PM -0700, Darrick J. Wong wrote:
> > On Thu, May 12, 2022 at 02:02:33PM -0500, Eric Sandeen wrote:
> > > On 5/5/22 11:05 AM, Darrick J. Wong wrote:
> > > > From: Darrick J. Wong <djwong@kernel.org>
> > > >
> > > > Make sure we detect and correct mismatches between the V5 features
> > > > described in the primary and the secondary superblocks.
> > > >
> > > > Signed-off-by: Darrick J. Wong <djwong@kernel.org>
> > > > ---
> > >
> > >
> > > > + if ((mp->m_sb.sb_features_incompat ^ sb->sb_features_incompat) &
> > > > + ~XFS_SB_FEAT_INCOMPAT_NEEDSREPAIR) {
> > >
> > > I'd like to add a comment about why XFS_SB_FEAT_INCOMPAT_NEEDSREPAIR is special.
> > > (Why is XFS_SB_FEAT_INCOMPAT_NEEDSREPAIR special? Just because userspace doesn't
> > > bother to set it on all superblocks in the upgrade paths, right?)
> >
> > Right -- we only set it on the primary super to force users to run
> > xfs_repair. Repair will clear NEEDSREPAIR on the primary and all
> > secondaries before it exits
>
> Oh no it doesn't! :)
>
> I just debugged the persistent xfs/158 failure down to repair only
> writing the secondary superblocks with "features_changed" is true.
>
> xfs/158 trashes the repair process after setting the inobtcnt and
> needrepair feature bits in the primary superblock. That's the only
> code that sets the internal "features_changed" flag that triggers
> secondary superblock writeback. If repair then dies after this it
> won't get set on the next run without the upgrade options set on the
> command line. Hence we re-run repair without the upgrade feature
> being enabled to check that it still recovers correctly.
>
> The result is that repair does the right thing in completing the
> feature upgrade because it sees the feature flag in the primary
> superblock, but it *never sets "features_changed"* and so the
> secondary superblocks are not updated when it is done. It then goes
> on to check NEEDSREPAIR in the primary superblock and clears it,
> allowing the fileystem to mount again.
>
> This results in secondary superblocks with in-progress set and
> mis-matched feature bits, resulting in xfs_scrub reporting corrupt
> secondary superblocks and so failing the test.
>
> This change will probably mask that specific bug - it'll still be
> lying their waiting to pounce on some unsuspecting bystander, but it
> will be masked by other code detecting the feature mismatch that it
> causes and correcting it that way...
Ah, ok. You're pointing out that repair needs to set features_changed
right after printing "clearing needsrepair flag and regenerating
metadata", and that this patch sort of papers over the underlying issue.
The genesis of this patch wasn't xfs/158 failing, it was the secondary
sb fuzz testing noticing that xfs_scrub reported a failure whereas
xfs_repair didn't.
So, I'll go add an extra patch to fix the upgrade case, and I think we
can let Eric add this one to his tree.
--D
> Cheers,
>
> Dave.
> --
> Dave Chinner
> david@fromorbit.com
next prev parent reply other threads:[~2022-05-16 17:59 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-05-05 16:05 [PATCHSET 0/3] xfs_repair: various small fixes Darrick J. Wong
2022-05-05 16:05 ` [PATCH 1/3] xfs_repair: detect v5 featureset mismatches in secondary supers Darrick J. Wong
2022-05-12 19:02 ` Eric Sandeen
2022-05-12 19:13 ` Darrick J. Wong
2022-05-16 8:11 ` Dave Chinner
2022-05-16 17:59 ` Darrick J. Wong [this message]
2022-05-05 16:05 ` [PATCH 2/3] xfs_repair: improve checking of existing rmap and refcount btrees Darrick J. Wong
2022-05-12 19:39 ` Eric Sandeen
2022-05-12 20:54 ` Darrick J. Wong
2022-05-05 16:06 ` [PATCH 3/3] xfs_repair: check the ftype of dot and dotdot directory entries Darrick J. Wong
2022-05-12 20:36 ` Eric Sandeen
2022-05-16 18:11 ` [PATCH 4/3] xfs_repair: always rewrite secondary supers when needsrepair is set Darrick J. Wong
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=YoKRDhAgythlT0if@magnolia \
--to=djwong@kernel.org \
--cc=david@fromorbit.com \
--cc=linux-xfs@vger.kernel.org \
--cc=sandeen@redhat.com \
--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