]> granicus.if.org Git - zfs/commitdiff
Add zfs_scan_ignore_errors tunable
authorTim Chase <tim@chase2k.com>
Tue, 13 Mar 2018 17:43:14 +0000 (12:43 -0500)
committerTony Hutter <hutter2@llnl.gov>
Tue, 8 May 2018 00:19:56 +0000 (17:19 -0700)
When it's set, a DTL range will be cleared even if its scan/scrub had
errors.  This allows to work around resilver/scrub upon import when the
pool has errors.

Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Tim Chase <tim@chase2k.com>
Closes #7293

man/man5/zfs-module-parameters.5
module/zfs/vdev.c

index 8d5ac2576141d3cf68829a0c0f9b0d336cebc413..bfcac1493cc4755d820bc00c58449796dd3c9f9e 100644 (file)
@@ -1699,6 +1699,20 @@ at least this much time working on a resilver between txg flushes.
 Default value: \fB3,000\fR.
 .RE
 
+.sp
+.ne 2
+.na
+\fBzfs_scan_ignore_errors\fR (int)
+.ad
+.RS 12n
+If set to a nonzero value, remove the DTL (dirty time list) upon
+completion of a pool scan (scrub) even if there were unrepairable
+errors.  It is intended to be used during pool repair or recovery to
+stop resilvering when the pool is next imported.
+.sp
+Default value: \fB0\fR.
+.RE
+
 .sp
 .ne 2
 .na
index 0786fbb834d753fd6e6bcfbd9588186fb0d0ea19..acac2a9737406ecc4843ccb47e3221db847a47f4 100644 (file)
@@ -66,6 +66,12 @@ unsigned int zfs_delays_per_second = 20;
  */
 unsigned int zfs_checksums_per_second = 20;
 
+/*
+ * Ignore errors during scrub/resilver.  Allows to work around resilver
+ * upon import when there are pool errors.
+ */
+int zfs_scan_ignore_errors = 0;
+
 /*
  * Virtual device management.
  */
@@ -1961,6 +1967,12 @@ vdev_dtl_reassess(vdev_t *vd, uint64_t txg, uint64_t scrub_txg, int scrub_done)
 
                mutex_enter(&vd->vdev_dtl_lock);
 
+               /*
+                * If requested, pretend the scan completed cleanly.
+                */
+               if (zfs_scan_ignore_errors && scn)
+                       scn->scn_phys.scn_errors = 0;
+
                /*
                 * If we've completed a scan cleanly then determine
                 * if this vdev should remove any DTLs. We only want to
@@ -3795,5 +3807,9 @@ module_param(zfs_checksums_per_second, uint, 0644);
        MODULE_PARM_DESC(zfs_checksums_per_second, "Rate limit checksum events "
        "to this many checksum errors per second (do not set below zed"
        "threshold).");
+
+module_param(zfs_scan_ignore_errors, int, 0644);
+MODULE_PARM_DESC(zfs_scan_ignore_errors,
+       "Ignore errors during resilver/scrub");
 /* END CSTYLED */
 #endif