Message ID | 153006769719.20121.5967943300879363502.stgit@magnolia (mailing list archive) |
---|---|
State | Accepted |
Headers | show |
On 6/26/18 7:48 PM, Darrick J. Wong wrote: > From: Darrick J. Wong <darrick.wong@oracle.com> > > Now that we have an error injection knob in the kernel to simulate > corruptions, enable it in xfs_scrub so that developers can test all > the repair capabilities. > > Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com> Reviewed-by: Eric Sandeen <sandeen@redhat.com> > --- > scrub/scrub.c | 8 ++++++-- > 1 file changed, 6 insertions(+), 2 deletions(-) > > > diff --git a/scrub/scrub.c b/scrub/scrub.c > index af665c83..c893f2c9 100644 > --- a/scrub/scrub.c > +++ b/scrub/scrub.c > @@ -612,14 +612,18 @@ __xfs_scrub_test( > bool repair) > { > struct xfs_scrub_metadata meta = {0}; > + struct xfs_error_injection inject; > static bool injected; > int error; > > if (debug_tweak_on("XFS_SCRUB_NO_KERNEL")) > return false; > if (debug_tweak_on("XFS_SCRUB_FORCE_REPAIR") && !injected) { > - str_info(ctx, "XFS_SCRUB_FORCE_REPAIR", "Not supported."); > - return false; > + inject.fd = ctx->mnt_fd; > + inject.errtag = XFS_ERRTAG_FORCE_SCRUB_REPAIR; > + error = ioctl(ctx->mnt_fd, XFS_IOC_ERROR_INJECTION, &inject); > + if (error == 0) > + injected = true; > } > > meta.sm_type = type; > > -- > To unsubscribe from this list: send the line "unsubscribe linux-xfs" in > the body of a message to majordomo@vger.kernel.org > More majordomo info at http://vger.kernel.org/majordomo-info.html > -- To unsubscribe from this list: send the line "unsubscribe linux-xfs" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
diff --git a/scrub/scrub.c b/scrub/scrub.c index af665c83..c893f2c9 100644 --- a/scrub/scrub.c +++ b/scrub/scrub.c @@ -612,14 +612,18 @@ __xfs_scrub_test( bool repair) { struct xfs_scrub_metadata meta = {0}; + struct xfs_error_injection inject; static bool injected; int error; if (debug_tweak_on("XFS_SCRUB_NO_KERNEL")) return false; if (debug_tweak_on("XFS_SCRUB_FORCE_REPAIR") && !injected) { - str_info(ctx, "XFS_SCRUB_FORCE_REPAIR", "Not supported."); - return false; + inject.fd = ctx->mnt_fd; + inject.errtag = XFS_ERRTAG_FORCE_SCRUB_REPAIR; + error = ioctl(ctx->mnt_fd, XFS_IOC_ERROR_INJECTION, &inject); + if (error == 0) + injected = true; } meta.sm_type = type;