From: Dave Chinner <david@fromorbit.com>
To: Darrick Wong <darrick.wong@oracle.com>
Cc: Srikanth C S <srikanth.c.s@oracle.com>,
"linux-xfs@vger.kernel.org" <linux-xfs@vger.kernel.org>,
Rajesh Sivaramasubramaniom
<rajesh.sivaramasubramaniom@oracle.com>,
Junxiao Bi <junxiao.bi@oracle.com>
Subject: Re: [PATCH] fsck.xfs: mount/umount xfs fs to replay log before running xfs_repair
Date: Tue, 11 Oct 2022 10:29:32 +1100 [thread overview]
Message-ID: <20221010232932.GW3600936@dread.disaster.area> (raw)
In-Reply-To: <CO1PR10MB44992848A2000EFE3A930871F8209@CO1PR10MB4499.namprd10.prod.outlook.com>
On Mon, Oct 10, 2022 at 03:40:51PM +0000, Darrick Wong wrote:
> LGTM, want to send this to the upstream list to start that discussion?
>
> --D
>
> ________________________________________
> From: Srikanth C S <srikanth.c.s@oracle.com>
> Sent: Monday, October 10, 2022 08:24
> To: linux-xfs@vger.kernel.org; Darrick Wong
> Cc: Rajesh Sivaramasubramaniom; Junxiao Bi
> Subject: [PATCH] fsck.xfs: mount/umount xfs fs to replay log before running xfs_repair
>
> fsck.xfs does xfs_repair -e if fsck.mode=force is set. It is
> possible that when the machine crashes, the fs is in inconsistent
> state with the journal log not yet replayed. This can put the
> machine into rescue shell. To address this problem, mount and
> umount the fs before running xfs_repair.
What's the purpose of forcing xfs_repair to be run on every boot?
The whole point of having a journalling filesystem is to avoid
needing to run fsck on every boot.
I get why one might want to occasionally force a repair check on
boot (e.g. to repair a problem with the root filesystem), but this
is a -rescue operation- and really shouldn't be occurring
automatically on every boot or after a kernel crash.
If it is only occurring during rescue operations, then why is it a problem
dumping out to a shell for the admin performing rescue
operations to deal with this directly? e.g. if the fs has a
corrupted journal, then a mount cycle will not fix the problem and
the admin will still get dumped into a rescue shell to fix the
problem manually.
Hence I don't really know why anyone would be configuring their
systems like this:
> Run xfs_repair -e when fsck.mode=force and repair=auto or yes.
as it makes no sense at all for a journalling filesystem.
> If fsck.mode=force and fsck.repair=no, run xfs_repair -n without
> replaying the logs.
Nor is it clear why anyone would want force a boot time fsck and
then not repair the damage that might be found....
More explanation, please!
> Signed-off-by: Srikanth C S <srikanth.c.s@oracle.com>
> ---
> fsck/xfs_fsck.sh | 20 ++++++++++++++++++--
> 1 file changed, 18 insertions(+), 2 deletions(-)
>
> diff --git a/fsck/xfs_fsck.sh b/fsck/xfs_fsck.sh
> index 6af0f22..21a8c19 100755
> --- a/fsck/xfs_fsck.sh
> +++ b/fsck/xfs_fsck.sh
> @@ -63,8 +63,24 @@ if [ -n "$PS1" -o -t 0 ]; then
> fi
>
> if $FORCE; then
> - xfs_repair -e $DEV
> - repair2fsck_code $?
> + if $AUTO; then
> + xfs_repair -e $DEV
> + error=$?
> + if [ $error -eq 2 ]; then
> + echo "Replaying log for $DEV"
> + mkdir -p /tmp/tmp_mnt
> + mount $DEV /tmp/tmp_mnt
> + umount /tmp/tmp_mnt
> + xfs_repair -e $DEV
> + error=$?
> + rmdir /tmp/tmp_mnt
> + fi
> + else
> + #fsck.mode=force is set but fsck.repair=no
> + xfs_repair -n $DEV
> + error=$?
> + fi
> + repair2fsck_code $error
> exit $?
> fi
As a side note, the patch has damaged whitespace....
Cheers,
Dave.
--
Dave Chinner
david@fromorbit.com
next prev parent reply other threads:[~2022-10-10 23:29 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <MWHPR10MB1486754F03696347F4E7FEE5A3209@MWHPR10MB1486.namprd10.prod.outlook.com>
2022-10-10 15:40 ` [PATCH] fsck.xfs: mount/umount xfs fs to replay log before running xfs_repair Darrick Wong
2022-10-10 23:29 ` Dave Chinner [this message]
2022-10-11 0:30 ` Darrick J. Wong
2022-10-11 4:26 ` Dave Chinner
2022-10-11 16:08 ` 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=20221010232932.GW3600936@dread.disaster.area \
--to=david@fromorbit.com \
--cc=darrick.wong@oracle.com \
--cc=junxiao.bi@oracle.com \
--cc=linux-xfs@vger.kernel.org \
--cc=rajesh.sivaramasubramaniom@oracle.com \
--cc=srikanth.c.s@oracle.com \
/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;
as well as URLs for NNTP newsgroup(s).