zfs/module
John Poduska c161360dce 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-09-22 11:33:35 -07:00
..
avl Fix typos in module/ 2020-01-22 13:48:59 -08:00
icp Replace sprintf()->snprintf() and strcpy()->strlcpy() 2020-09-15 21:16:58 +00:00
lua Fix lua stack overflow on recursive call to gsub() 2020-09-16 14:17:32 -07:00
nvpair cppcheck: (warning) Possible null pointer dereference: nvh 2020-01-22 13:49:06 -08:00
spl Switch off -Wmissing-prototypes for libgcc math functions 2020-09-15 21:21:05 +00:00
unicode Update build system and packaging 2018-05-29 16:00:33 -07:00
zcommon Bugfix/fix uio partial copies 2020-05-12 10:53:32 -07:00
zfs Resilver restarts unnecessarily when it encounters errors 2020-09-22 11:33:35 -07:00
.gitignore Adapt gitignore for modules 2020-01-22 13:49:05 -08:00
Makefile.in module/Makefile.in: don't run xargs if empty 2020-01-22 13:49:02 -08:00