mirror of
https://git.proxmox.com/git/mirror_zfs.git
synced 2025-05-23 15:04:59 +03:00
Fix race between resilver wait and offline/detach
We should not clear scn_state and notify waiters until we call vdev_dtl_reassess(), otherwise following offline/detach request may fail with "no valid replicas". Signed-off-by: Alexander Motin <mav@FreeBSD.org> Sponsored by: iXsystems, Inc.
This commit is contained in:
parent
634c172ee8
commit
f86d9af16b
@ -1132,10 +1132,6 @@ dsl_scan_done(dsl_scan_t *scn, boolean_t complete, dmu_tx_t *tx)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
scn->scn_phys.scn_state = complete ? DSS_FINISHED : DSS_CANCELED;
|
|
||||||
|
|
||||||
spa_notify_waiters(spa);
|
|
||||||
|
|
||||||
if (dsl_scan_restarting(scn, tx)) {
|
if (dsl_scan_restarting(scn, tx)) {
|
||||||
spa_history_log_internal(spa, "scan aborted, restarting", tx,
|
spa_history_log_internal(spa, "scan aborted, restarting", tx,
|
||||||
"errors=%llu", (u_longlong_t)spa_approx_errlog_size(spa));
|
"errors=%llu", (u_longlong_t)spa_approx_errlog_size(spa));
|
||||||
@ -1194,6 +1190,9 @@ dsl_scan_done(dsl_scan_t *scn, boolean_t complete, dmu_tx_t *tx)
|
|||||||
* Don't clear flag until after vdev_dtl_reassess to ensure that
|
* Don't clear flag until after vdev_dtl_reassess to ensure that
|
||||||
* DTL_MISSING will get updated when possible.
|
* DTL_MISSING will get updated when possible.
|
||||||
*/
|
*/
|
||||||
|
scn->scn_phys.scn_state = complete ? DSS_FINISHED :
|
||||||
|
DSS_CANCELED;
|
||||||
|
scn->scn_phys.scn_end_time = gethrestime_sec();
|
||||||
spa->spa_scrub_started = B_FALSE;
|
spa->spa_scrub_started = B_FALSE;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -1223,9 +1222,13 @@ dsl_scan_done(dsl_scan_t *scn, boolean_t complete, dmu_tx_t *tx)
|
|||||||
/* Clear recent error events (i.e. duplicate events tracking) */
|
/* Clear recent error events (i.e. duplicate events tracking) */
|
||||||
if (complete)
|
if (complete)
|
||||||
zfs_ereport_clear(spa, NULL);
|
zfs_ereport_clear(spa, NULL);
|
||||||
|
} else {
|
||||||
|
scn->scn_phys.scn_state = complete ? DSS_FINISHED :
|
||||||
|
DSS_CANCELED;
|
||||||
|
scn->scn_phys.scn_end_time = gethrestime_sec();
|
||||||
}
|
}
|
||||||
|
|
||||||
scn->scn_phys.scn_end_time = gethrestime_sec();
|
spa_notify_waiters(spa);
|
||||||
|
|
||||||
if (spa->spa_errata == ZPOOL_ERRATA_ZOL_2094_SCRUB)
|
if (spa->spa_errata == ZPOOL_ERRATA_ZOL_2094_SCRUB)
|
||||||
spa->spa_errata = 0;
|
spa->spa_errata = 0;
|
||||||
|
Loading…
Reference in New Issue
Block a user