summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKody A Kantor <[email protected]>2019-09-22 17:25:39 -0500
committerTony Hutter <[email protected]>2019-09-25 11:27:51 -0700
commitc37fa0d5a86c1ce646fcceecfbb069d3dc1dc36d (patch)
tree27039984a8f00745ed81a2b799fd0484277f174c
parent12a78fbb4fcbba6c4c8d9b0aa34d23e33107b0ae (diff)
Disabled resilver_defer feature leads to looping resilvers
When a disk is replaced with another on a pool with the resilver_defer feature present, but not enabled the resilver activity restarts during each spa_sync. This patch checks to make sure that the resilver_defer feature is first enabled before requesting a deferred resilver. This was originally fixed in illumos-joyent as OS-7982. Reviewed-by: Chris Dunlop <[email protected]> Reviewed-by: George Melikov <[email protected]> Reviewed-by: Brian Behlendorf <[email protected]> Reviewed-by: Tom Caputi <[email protected]> Reviewed by: Jerry Jelinek <[email protected]> Signed-off-by: Kody A Kantor <[email protected]> External-issue: illumos-joyent OS-7982 Closes #9299 Closes #9338
-rw-r--r--module/zfs/dsl_scan.c19
1 files changed, 11 insertions, 8 deletions
diff --git a/module/zfs/dsl_scan.c b/module/zfs/dsl_scan.c
index 9ccb17b7e..202c6e8d8 100644
--- a/module/zfs/dsl_scan.c
+++ b/module/zfs/dsl_scan.c
@@ -23,7 +23,7 @@
* Copyright (c) 2011, 2017 by Delphix. All rights reserved.
* Copyright 2016 Gary Mills
* Copyright (c) 2017 Datto Inc.
- * Copyright 2017 Joyent, Inc.
+ * Copyright 2019 Joyent, Inc.
*/
#include <sys/dsl_scan.h>
@@ -952,13 +952,16 @@ dsl_scan_done(dsl_scan_t *scn, boolean_t complete, dmu_tx_t *tx)
* will find the drives that need to be resilvered
* when the machine reboots and start the resilver then.
*/
- boolean_t resilver_needed =
- dsl_scan_clear_deferred(spa->spa_root_vdev, tx);
- if (resilver_needed) {
- spa_history_log_internal(spa,
- "starting deferred resilver", tx,
- "errors=%llu", spa_get_errlog_size(spa));
- spa_async_request(spa, SPA_ASYNC_RESILVER);
+ if (spa_feature_is_enabled(spa, SPA_FEATURE_RESILVER_DEFER)) {
+ boolean_t resilver_needed =
+ dsl_scan_clear_deferred(spa->spa_root_vdev, tx);
+ if (resilver_needed) {
+ spa_history_log_internal(spa,
+ "starting deferred resilver", tx,
+ "errors=%llu",
+ (u_longlong_t)spa_get_errlog_size(spa));
+ spa_async_request(spa, SPA_ASYNC_RESILVER);
+ }
}
}