From: Brian Foster <bfoster@redhat.com>
To: "Darrick J. Wong" <djwong@kernel.org>
Cc: sandeen@sandeen.net, linux-xfs@vger.kernel.org
Subject: Re: [PATCH 3/3] xfs_repair: add post-phase error injection points
Date: Tue, 16 Feb 2021 06:58:39 -0500 [thread overview]
Message-ID: <20210216115839.GD534175@bfoster> (raw)
In-Reply-To: <161319522176.422860.4620061453225202229.stgit@magnolia>
On Fri, Feb 12, 2021 at 09:47:01PM -0800, Darrick J. Wong wrote:
> From: Darrick J. Wong <djwong@kernel.org>
>
> Create an error injection point so that we can simulate repair failing
> after a certain phase.
>
> Signed-off-by: Darrick J. Wong <djwong@kernel.org>
> ---
> repair/globals.c | 3 +++
> repair/globals.h | 3 +++
> repair/progress.c | 3 +++
> repair/xfs_repair.c | 4 ++++
> 4 files changed, 13 insertions(+)
>
>
...
> diff --git a/repair/progress.c b/repair/progress.c
> index e5a9c1ef..5bbe58ec 100644
> --- a/repair/progress.c
> +++ b/repair/progress.c
> @@ -410,6 +410,9 @@ timestamp(int end, int phase, char *buf)
> current_phase = phase;
> }
>
> + if (fail_after_phase && phase == fail_after_phase)
> + kill(getpid(), SIGKILL);
> +
It seems a little hacky to bury this in timestamp(). Perhaps we should
at least check for end == PHASE_END (even though PHASE_START is
currently only used in one place). Otherwise seems reasonable..
Brian
> if (buf) {
> tmp = localtime((const time_t *)&now);
> sprintf(buf, _("%02d:%02d:%02d"), tmp->tm_hour, tmp->tm_min, tmp->tm_sec);
> diff --git a/repair/xfs_repair.c b/repair/xfs_repair.c
> index 12e319ae..6b60b8f4 100644
> --- a/repair/xfs_repair.c
> +++ b/repair/xfs_repair.c
> @@ -362,6 +362,10 @@ process_args(int argc, char **argv)
>
> if (report_corrected && no_modify)
> usage();
> +
> + p = getenv("XFS_REPAIR_FAIL_AFTER_PHASE");
> + if (p)
> + fail_after_phase = (int)strtol(p, NULL, 0);
> }
>
> void __attribute__((noreturn))
>
next prev parent reply other threads:[~2021-02-16 12:02 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-02-13 5:46 [PATCHSET 0/3] xfs_repair: set needsrepair when dirtying filesystems Darrick J. Wong
2021-02-13 5:46 ` [PATCH 1/3] xfs_repair: set NEEDSREPAIR the first time we write to a filesystem Darrick J. Wong
2021-02-16 11:55 ` Brian Foster
2021-02-18 4:45 ` Darrick J. Wong
2021-02-18 12:59 ` Brian Foster
2021-02-18 17:07 ` Darrick J. Wong
2021-02-13 5:46 ` [PATCH 2/3] libxfs: simulate system failure after a certain number of writes Darrick J. Wong
2021-02-16 11:56 ` Brian Foster
2021-02-18 4:36 ` Darrick J. Wong
2021-02-18 13:02 ` Brian Foster
2021-02-18 17:42 ` Darrick J. Wong
2021-02-13 5:47 ` [PATCH 3/3] xfs_repair: add post-phase error injection points Darrick J. Wong
2021-02-16 11:58 ` Brian Foster [this message]
2021-02-18 4:47 ` Darrick J. Wong
2021-02-18 13:02 ` Brian Foster
2021-02-18 18:01 ` 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=20210216115839.GD534175@bfoster \
--to=bfoster@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;
as well as URLs for NNTP newsgroup(s).