From 8100df022b44f98ba4310b1dec6e08d2b81b2ec6 Mon Sep 17 00:00:00 2001 From: Pavel Snajdr Date: Wed, 24 Jan 2024 21:16:44 +0100 Subject: [PATCH] Defer resilver only when progress is above a threshold v2 Fix the restart_early condition to avoid restart loop on pool export. --- module/zfs/dsl_scan.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/module/zfs/dsl_scan.c b/module/zfs/dsl_scan.c index c7ae183558..4bd36c336b 100644 --- a/module/zfs/dsl_scan.c +++ b/module/zfs/dsl_scan.c @@ -4284,7 +4284,8 @@ dsl_scan_sync(dsl_pool_t *dp, dmu_tx_t *tx) /* * Make sure we're not in a restart loop and check the threshold */ - restart_early = spa->spa_resilver_deferred && + restart_early = (spa_sync_pass(spa) == 1) && + spa->spa_resilver_deferred && !dsl_scan_restarting(scn, tx) && (issued < (to_issue * zfs_resilver_defer_percent / 100));