From: Eric Sandeen <sandeen@sandeen.net>
To: "Darrick J. Wong" <djwong@kernel.org>
Cc: linux-xfs@vger.kernel.org, bfoster@redhat.com
Subject: Re: [PATCH 4/4] xfs_repair: add post-phase error injection points
Date: Fri, 19 Feb 2021 19:00:10 -0600 [thread overview]
Message-ID: <0af3d64b-c98c-f785-f9ca-59bcb8dbb2ff@sandeen.net> (raw)
In-Reply-To: <161370469573.2389661.2370498929966302970.stgit@magnolia>
On 2/18/21 9:18 PM, 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>
Well this is refreshingly simple ;)
Reviewed-by: Eric Sandeen <sandeen@redhat.com>
> ---
> repair/globals.c | 3 +++
> repair/globals.h | 3 +++
> repair/xfs_repair.c | 8 ++++++++
> 3 files changed, 14 insertions(+)
>
>
> diff --git a/repair/globals.c b/repair/globals.c
> index 110d98b6..537d068b 100644
> --- a/repair/globals.c
> +++ b/repair/globals.c
> @@ -117,3 +117,6 @@ uint64_t *prog_rpt_done;
>
> int ag_stride;
> int thread_count;
> +
> +/* If nonzero, simulate failure after this phase. */
> +int fail_after_phase;
> diff --git a/repair/globals.h b/repair/globals.h
> index 1d397b35..a9287320 100644
> --- a/repair/globals.h
> +++ b/repair/globals.h
> @@ -162,4 +162,7 @@ extern uint64_t *prog_rpt_done;
> extern int ag_stride;
> extern int thread_count;
>
> +/* If nonzero, simulate failure after this phase. */
> +extern int fail_after_phase;
> +
> #endif /* _XFS_REPAIR_GLOBAL_H */
> diff --git a/repair/xfs_repair.c b/repair/xfs_repair.c
> index 891b3b23..33062170 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))
> @@ -851,6 +855,10 @@ static inline void
> phase_end(int phase)
> {
> timestamp(PHASE_END, phase, NULL);
> +
> + /* Fail if someone injected an post-phase error. */
> + if (fail_after_phase && phase == fail_after_phase)
> + platform_crash();
> }
>
> int
>
next prev parent reply other threads:[~2021-02-20 1:00 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-02-19 3:17 [PATCHSET v2 0/4] xfs_repair: set needsrepair when dirtying filesystems Darrick J. Wong
2021-02-19 3:17 ` [PATCH 1/4] xfs_repair: set NEEDSREPAIR the first time we write to a filesystem Darrick J. Wong
2021-02-20 0:32 ` Eric Sandeen
2021-02-20 0:47 ` Darrick J. Wong
2021-02-22 14:11 ` Brian Foster
2021-02-19 3:18 ` [PATCH 2/4] libxfs: simulate system failure after a certain number of writes Darrick J. Wong
2021-02-20 0:51 ` Eric Sandeen
2021-02-20 1:15 ` Darrick J. Wong
2021-02-22 14:11 ` Brian Foster
2021-02-19 3:18 ` [PATCH 3/4] xfs_repair: factor phase transitions into a helper Darrick J. Wong
2021-02-20 0:58 ` Eric Sandeen
2021-02-22 14:11 ` Brian Foster
2021-02-19 3:18 ` [PATCH 4/4] xfs_repair: add post-phase error injection points Darrick J. Wong
2021-02-20 1:00 ` Eric Sandeen [this message]
2021-02-22 14:11 ` Brian Foster
2021-02-23 3:01 [PATCHSET v3 0/4] xfs_repair: set needsrepair when dirtying filesystems Darrick J. Wong
2021-02-23 3:01 ` [PATCH 4/4] xfs_repair: add post-phase error injection points Darrick J. Wong
2021-02-24 5:39 ` Allison Henderson
2021-02-25 8:19 ` 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=0af3d64b-c98c-f785-f9ca-59bcb8dbb2ff@sandeen.net \
--to=sandeen@sandeen.net \
--cc=bfoster@redhat.com \
--cc=djwong@kernel.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;
as well as URLs for NNTP newsgroup(s).