Skip to content

Commit

Permalink
Postpone dropping namespace lock until after checkpoint setup
Browse files Browse the repository at this point in the history
This fixes test failures seen in:
    functioinal/mmp
    functional/pool_checkpoint

Signed-off-by: Don Brady <[email protected]>
  • Loading branch information
don-brady committed Feb 22, 2024
1 parent 12805b0 commit 2822961
Showing 1 changed file with 12 additions and 7 deletions.
19 changes: 12 additions & 7 deletions module/zfs/spa.c
Original file line number Diff line number Diff line change
Expand Up @@ -1722,7 +1722,8 @@ spa_destroy_aux_threads(spa_t *spa)
static void
spa_unload(spa_t *spa)
{
ASSERT(MUTEX_HELD(&spa_namespace_lock));
ASSERT(MUTEX_HELD(&spa_namespace_lock) ||
spa->spa_load_thread == curthread);
ASSERT(spa_state(spa) != POOL_STATE_UNINITIALIZED);

spa_import_progress_remove(spa_guid(spa));
Expand Down Expand Up @@ -4737,7 +4738,8 @@ spa_ld_mos_init(spa_t *spa, spa_import_type_t type)
{
int error = 0;

ASSERT(MUTEX_HELD(&spa_namespace_lock));
ASSERT(MUTEX_HELD(&spa_namespace_lock) ||
spa->spa_load_thread == curthread);
ASSERT(spa->spa_config_source != SPA_CONFIG_SRC_NONE);

/*
Expand Down Expand Up @@ -4969,9 +4971,6 @@ spa_load_impl(spa_t *spa, spa_import_type_t type, const char **ereport)
if (error != 0)
return (error);

spa->spa_load_thread = curthread;
mutex_exit(&spa_namespace_lock);

/*
* If we are rewinding to the checkpoint then we need to repeat
* everything we've done so far in this function but this time
Expand All @@ -4993,7 +4992,7 @@ spa_load_impl(spa_t *spa, spa_import_type_t type, const char **ereport)
*/
error = spa_ld_checkpoint_rewind(spa);
if (error != 0)
goto fail;
return (error);

/*
* Redo the loading process again with the
Expand All @@ -5003,9 +5002,15 @@ spa_load_impl(spa_t *spa, spa_import_type_t type, const char **ereport)
spa_load_note(spa, "LOADING checkpointed uberblock");
error = spa_ld_mos_with_trusted_config(spa, type, NULL);
if (error != 0)
goto fail;
return (error);
}

/*
* Namespace no longer needed past this point
*/
spa->spa_load_thread = curthread;
mutex_exit(&spa_namespace_lock);

/*
* Retrieve the checkpoint txg if the pool has a checkpoint.
*/
Expand Down

0 comments on commit 2822961

Please sign in to comment.