From: "Darrick J. Wong" <darrick.wong@oracle.com>
To: sandeen@sandeen.net
Cc: linux-xfs@vger.kernel.org
Subject: [PATCH v2 02/11] xfs_scrub: abort all read verification work immediately on error
Date: Tue, 15 Oct 2019 10:21:53 -0700 [thread overview]
Message-ID: <20191015172153.GJ13108@magnolia> (raw)
From: Darrick J. Wong <darrick.wong@oracle.com>
Add a new abort function to the read verify pool code so that the caller
can immediately abort all pending verification work if things start
going wrong. There's no point in waiting for queued work to run if
we've already decided to bail.
Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
---
v2: fix errors_seen bogosity
---
scrub/phase6.c | 6 +++---
scrub/read_verify.c | 10 ++++++++++
scrub/read_verify.h | 1 +
3 files changed, 14 insertions(+), 3 deletions(-)
diff --git a/scrub/phase6.c b/scrub/phase6.c
index d9285fee..4c81ee7b 100644
--- a/scrub/phase6.c
+++ b/scrub/phase6.c
@@ -514,16 +514,16 @@ _("Could not create data device media verifier."));
out_rtpool:
if (vs.rvp_realtime) {
- read_verify_pool_flush(vs.rvp_realtime);
+ read_verify_pool_abort(vs.rvp_realtime);
read_verify_pool_destroy(vs.rvp_realtime);
}
out_logpool:
if (vs.rvp_log) {
- read_verify_pool_flush(vs.rvp_log);
+ read_verify_pool_abort(vs.rvp_log);
read_verify_pool_destroy(vs.rvp_log);
}
out_datapool:
- read_verify_pool_flush(vs.rvp_data);
+ read_verify_pool_abort(vs.rvp_data);
read_verify_pool_destroy(vs.rvp_data);
out_rbad:
bitmap_free(&vs.r_bad);
diff --git a/scrub/read_verify.c b/scrub/read_verify.c
index d020ce2f..835b9660 100644
--- a/scrub/read_verify.c
+++ b/scrub/read_verify.c
@@ -121,6 +121,16 @@ read_verify_pool_init(
return NULL;
}
+/* Abort all verification work. */
+void
+read_verify_pool_abort(
+ struct read_verify_pool *rvp)
+{
+ if (!rvp->runtime_error)
+ rvp->runtime_error = ECANCELED;
+ workqueue_terminate(&rvp->wq);
+}
+
/* Finish up any read verification work. */
void
read_verify_pool_flush(
diff --git a/scrub/read_verify.h b/scrub/read_verify.h
index 5fabe5e0..f0ed8902 100644
--- a/scrub/read_verify.h
+++ b/scrub/read_verify.h
@@ -19,6 +19,7 @@ struct read_verify_pool *read_verify_pool_init(struct scrub_ctx *ctx,
struct disk *disk, size_t miniosz,
read_verify_ioerr_fn_t ioerr_fn,
unsigned int submitter_threads);
+void read_verify_pool_abort(struct read_verify_pool *rvp);
void read_verify_pool_flush(struct read_verify_pool *rvp);
void read_verify_pool_destroy(struct read_verify_pool *rvp);
reply other threads:[~2019-10-15 17:21 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=20191015172153.GJ13108@magnolia \
--to=darrick.wong@oracle.com \
--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