From 3b7f360c9606079c518829c5bd82fe8f8a89e3c0 Mon Sep 17 00:00:00 2001 From: George Wilson Date: Fri, 7 Apr 2017 13:50:18 -0700 Subject: OpenZFS 8023 - Panic destroying a metaslab deferred range tree MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Authored by: George Wilson Approved by: Dan McDonald Reviewed by: Brad Lewis Reviewed by: Matt Ahrens Reviewed by: Dan Kimmel Reviewed by: Saso Kiselkov Reviewed-by: Brian Behlendorf Reviewed-by: George Melikov Ported-by: Giuseppe Di Natale We don't want to dirty any data when we're in the final txgs of the pool export logic. This change introduces checks to make sure that no data is dirtied after a certain point. It also addresses the culprit of this specific bug – the space map cannot be upgraded when we're in final stages of pool export. If we encounter a space map that wants to be upgraded in this phase, then we simply ignore the request as it will get retried the next time we set the fragmentation metric on that metaslab. OpenZFS-issue: https://www.illumos.org/issues/8023 OpenZFS-commit: https://github.com/openzfs/openzfs/commit/2ef00f5 Closes #5991 --- module/zfs/spa_misc.c | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'module/zfs/spa_misc.c') diff --git a/module/zfs/spa_misc.c b/module/zfs/spa_misc.c index ea16e69f0..39a1d7d6a 100644 --- a/module/zfs/spa_misc.c +++ b/module/zfs/spa_misc.c @@ -1596,6 +1596,16 @@ spa_syncing_txg(spa_t *spa) return (spa->spa_syncing_txg); } +/* + * Return the last txg where data can be dirtied. The final txgs + * will be used to just clear out any deferred frees that remain. + */ +uint64_t +spa_final_dirty_txg(spa_t *spa) +{ + return (spa->spa_final_txg - TXG_DEFER_SIZE); +} + pool_state_t spa_state(spa_t *spa) { -- cgit v1.2.3