zfs/module
John Poduska 41035a0496
Resilver restarts unnecessarily when it encounters errors
When a resilver finishes, vdev_dtl_reassess is called to hopefully
excise DTL_MISSING (amongst other things). If there are errors during
the resilver, they are tracked in DTL_SCRUB, as spelled out in the
block comment in vdev.c. DTL_SCRUB is in-core only, so it can only
be used if the pool was online for the whole resilver. This state is
tracked with the spa_scrub_started flag, which only gets set when
the scan is initialized. Unfortunately, this flag gets cleared right
before vdev_dtl_reassess gets called, so if there are any errors
during the scan, DTL_MISSING will never get excised and the resilver
will just continually restart. This fix simply moves clearing that
flag until after the call to vdev_dtl_reasses.

In addition, if a pool is imported and already has scn_errors > 0,
this change will restart the resilver immediately instead of doing
the rest of the scan and then restarting it from the beginning. On
the other hand, if scn_errors == 0 at import, then no errors have
been encountered so far, so the spa_scrub_started flag can be safely
set.

A test has been added to verify that resilver does not restart when
relevant DTL's are available.

Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Reviewed-by: Paul Zuchowski <pzuchowski@datto.com>
Signed-off-by: John Poduska <jpoduska@datto.com>
Closes #10291
2020-05-13 10:54:27 -07:00
..
avl Wrap Linux module macros 2019-11-01 10:41:03 -07:00
icp Remove checks for null out value in encryption paths 2020-03-26 10:41:57 -07:00
lua Add longjmp support for Thumb-2 2020-04-29 17:30:13 -07:00
nvpair cppcheck: (warning) Possible null pointer dereference: nvh 2019-12-18 17:25:57 -08:00
os Combine OS-independent ABD Code into Common Source File 2020-05-10 12:23:52 -07:00
spl OpenZFS restructuring - move platform specific sources 2019-09-06 11:26:26 -07:00
unicode Wrap Linux module macros 2019-11-01 10:41:03 -07:00
zcommon OpenZFS 3254 - add support in zfs for aclmode=restricted 2020-04-30 11:23:59 -07:00
zfs Resilver restarts unnecessarily when it encounters errors 2020-05-13 10:54:27 -07:00
.gitignore Add FreeBSD support to OpenZFS 2020-04-14 11:36:28 -07:00
Makefile.bsd Combine OS-independent ABD Code into Common Source File 2020-05-10 12:23:52 -07:00
Makefile.in Add FreeBSD support to OpenZFS 2020-04-14 11:36:28 -07:00