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>
Reviewed-by: Eric Sandeen <sandeen@redhat.com>
Reviewed-by: Brian Foster <bfoster@redhat.com>
Signed-off-by: Eric Sandeen <sandeen@sandeen.net>
int ag_stride;
int thread_count;
+
+/* If nonzero, simulate failure after this phase. */
+int fail_after_phase;
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 */
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))
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