mirror_zfs/tests/zfs-tests/include
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
..
.gitignore Add zpool events tests 2017-05-22 12:34:42 -04:00
blkdev.shlib ZTS: Another round of changes for FreeBSD 2020-03-06 09:31:32 -08:00
commands.cfg Add zstream redup command to convert deduplicated send streams 2020-04-10 10:39:55 -07:00
default.cfg.in ZTS: Fix a few defaults 2020-01-31 08:51:23 -08:00
libtest.shlib ZTS: Count CKSUM for all vdevs in verify_pool 2020-04-30 17:50:16 -07:00
Makefile.am ZTS: Catalog tunable names for tests in tunables.cfg 2020-01-14 14:57:28 -08:00
math.shlib ZTS: Eliminate functions named 'random' 2020-01-08 09:08:30 -08:00
properties.shlib ZTS: Don't use edonr on FreeBSD 2020-01-28 08:38:02 -08:00
tunables.cfg Resilver restarts unnecessarily when it encounters errors 2020-05-13 10:54:27 -07:00
zpool_script.shlib zfs-tests: fix warnings when packaging some .shlib files 2019-05-24 14:12:14 -07:00