From: Dave Chinner <dgc@kernel.org>
To: Chris Wedgwood <cw@f00f.org>
Cc: linux-xfs@vger.kernel.org
Subject: Re: [PATCH 8/9] xfs_repair: add -R to replay a dirty log before repairing
Date: Thu, 3 Sep 2026 09:57:34 +1000 [thread overview]
Message-ID: <api37phrWBn56RHo@dread> (raw)
In-Reply-To: <ac7ec2c4f9f0a64d2994dd21fd4d620942b2c745.1788110147.git.cw@f00f.org>
On Wed, Aug 26, 2026 at 10:25:44PM -0700, Chris Wedgwood wrote:
> xfs_repair refuses to run on a filesystem with a dirty log, and the only
> way past that has been -L, which destroys the log and every metadata
> update it describes. The advice is to mount and unmount the filesystem
> first, which is not available when the filesystem cannot be mounted, or
> when the machine that crashed is gone.
>
> -R replays the log first, using the kernel's own recovery code, and then
> repairs the result. It is defined to be equivalent to mounting the
> filesystem, unmounting it cleanly, and repairing that - so it retires the
> log afterwards, and refuses to run alongside -L or -n.
....
> + /*
> + * From here on intents are being completed for real. Userspace writes
> + * no done items, so an intent finished before a failure is still
> + * described by the log we did not retire, and replaying that log again
> + * - here or by a kernel mount - would apply it a second time. Say so,
> + * because the obvious response to a failure is to try again.
> + */
> + error = -xlog_recover_finish(log);
> + if (error)
> + do_error(
> + _("Log recovery completion failed: %s\n"
> + "Some intents may already have been applied. Do not replay this log\n"
> + "again, by mount or by -R, as that would apply them twice. Use -L to\n"
> + "discard the log and repair instead.\n"),
> + strerror(error));
Urk. That's a red flag. Log recovery should -always- be retriable,
even if there are failures replaying intents.
The progress that intent processing makes writes new records to the
journal (intents and modified objects), and so running log recovery
a second time will continue where the intent replay failed last
time. i.e. it will recover all the changes up to the last failure,
then attempt to replay the remaining intents that are pending in the
journal.
If the userspace log recovery cannot be run repeatedly on recovery
failure without bad things happening, then the code is buggy. Only
once the recovery gets to the point that no new objects can be
recovered because of persistent failures should the user need to
resort to clearing the log....
Also, why are you copy/pasting and subtly modifying all the kernel
log recovery code here instead of running the kernel code in libxlog
directly?
Cheers,
Dave.
--
Dave Chinner
dgc@kernel.org
next prev parent reply other threads:[~2026-09-02 23:57 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-30 17:15 [PATCH 0/9] xfsprogs: add xfs_repair -R --- log replay Chris Wedgwood
2026-08-21 0:22 ` [PATCH 1/9] libxfs: make XBF_DONE actually mark a buffer uptodate Chris Wedgwood
2026-08-31 13:37 ` Christoph Hellwig
2026-08-21 0:26 ` [PATCH 2/9] libxfs: don't corrupt a delwri list when a buffer is queued twice Chris Wedgwood
2026-08-31 13:38 ` Christoph Hellwig
2026-08-21 5:42 ` [PATCH 3/9] libxfs: record a failed buffer write when it fails Chris Wedgwood
2026-08-31 13:39 ` Christoph Hellwig
2026-08-27 5:08 ` [PATCH 6/9] libxfs-diff: also compare libxlog against the kernel Chris Wedgwood
2026-08-31 13:40 ` Christoph Hellwig
2026-08-31 17:37 ` Darrick J. Wong
2026-09-02 23:25 ` Dave Chinner
2026-08-27 5:08 ` [PATCH 4/9] libxlog: rename xfs_log_recover.c to logscan.c Chris Wedgwood
2026-08-31 13:42 ` Christoph Hellwig
2026-08-27 5:09 ` [PATCH 5/9] libxlog: import the kernel's log recovery, log items and AIL Chris Wedgwood
2026-08-31 13:45 ` Christoph Hellwig
2026-09-02 23:48 ` Dave Chinner
2026-08-27 5:24 ` [PATCH 7/9] libxlog: build the imported kernel code Chris Wedgwood
2026-08-31 13:46 ` Christoph Hellwig
2026-08-27 5:25 ` [PATCH 8/9] xfs_repair: add -R to replay a dirty log before repairing Chris Wedgwood
2026-08-31 13:48 ` Christoph Hellwig
2026-09-02 23:57 ` Dave Chinner [this message]
2026-08-27 5:48 ` [PATCH 9/9] xfs_repair: finish deletions the crash interrupted Chris Wedgwood
2026-08-31 13:50 ` Christoph Hellwig
2026-08-31 13:36 ` [PATCH 0/9] xfsprogs: add xfs_repair -R --- log replay Christoph Hellwig
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=api37phrWBn56RHo@dread \
--to=dgc@kernel.org \
--cc=cw@f00f.org \
--cc=linux-xfs@vger.kernel.org \
/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