diff --git a/include/sys/dsl_scan.h b/include/sys/dsl_scan.h index 19c3dd599..fb1f1d65b 100644 --- a/include/sys/dsl_scan.h +++ b/include/sys/dsl_scan.h @@ -163,6 +163,7 @@ typedef struct dsl_scan_io_queue dsl_scan_io_queue_t; void scan_init(void); void scan_fini(void); int dsl_scan_init(struct dsl_pool *dp, uint64_t txg); +int dsl_scan_setup_check(void *, dmu_tx_t *); void dsl_scan_setup_sync(void *, dmu_tx_t *); void dsl_scan_fini(struct dsl_pool *dp); void dsl_scan_sync(struct dsl_pool *, dmu_tx_t *); diff --git a/module/zfs/dsl_scan.c b/module/zfs/dsl_scan.c index a54cd6ca8..cc1cbcdb9 100644 --- a/module/zfs/dsl_scan.c +++ b/module/zfs/dsl_scan.c @@ -701,7 +701,7 @@ dsl_scan_sync_state(dsl_scan_t *scn, dmu_tx_t *tx, state_sync_type_t sync_type) } /* ARGSUSED */ -static int +int dsl_scan_setup_check(void *arg, dmu_tx_t *tx) { dsl_scan_t *scn = dmu_tx_pool(tx)->dp_scan; diff --git a/module/zfs/vdev_rebuild.c b/module/zfs/vdev_rebuild.c index aa79642aa..4d7de0c6c 100644 --- a/module/zfs/vdev_rebuild.c +++ b/module/zfs/vdev_rebuild.c @@ -331,9 +331,9 @@ vdev_rebuild_complete_sync(void *arg, dmu_tx_t *tx) * While we're in syncing context take the opportunity to * setup the scrub when there are no more active rebuilds. */ - if (!vdev_rebuild_active(spa->spa_root_vdev) && + pool_scan_func_t func = POOL_SCAN_SCRUB; + if (dsl_scan_setup_check(&func, tx) == 0 && zfs_rebuild_scrub_enabled) { - pool_scan_func_t func = POOL_SCAN_SCRUB; dsl_scan_setup_sync(&func, tx); }