Add spa _os() hooks

Add hooks for when spa is created, exported, activated and
deactivated. Used by macOS to attach iokit, and lock
kext as busy (to stop unloads).

Userland, Linux, and, FreeBSD have empty stubs.

Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Jorgen Lundman <lundman@lundman.net>
Closes #12801
This commit is contained in:
Jorgen Lundman
2022-02-16 08:54:25 +09:00
committed by GitHub
parent 2fb52853dc
commit 4759342a5e
5 changed files with 88 additions and 0 deletions
+11
View File
@@ -1315,6 +1315,8 @@ spa_activate(spa_t *spa, spa_mode_t mode)
spa_error_entry_compare, sizeof (spa_error_entry_t),
offsetof(spa_error_entry_t, se_avl));
spa_activate_os(spa);
spa_keystore_init(&spa->spa_keystore);
/*
@@ -1451,6 +1453,9 @@ spa_deactivate(spa_t *spa)
thread_join(spa->spa_did);
spa->spa_did = 0;
}
spa_deactivate_os(spa);
}
/*
@@ -6031,6 +6036,8 @@ spa_create(const char *pool, nvlist_t *nvroot, nvlist_t *props,
spa->spa_minref = zfs_refcount_count(&spa->spa_refcount);
spa->spa_load_state = SPA_LOAD_NONE;
spa_import_os(spa);
mutex_exit(&spa_namespace_lock);
return (0);
@@ -6214,6 +6221,8 @@ spa_import(char *pool, nvlist_t *config, nvlist_t *props, uint64_t flags)
zvol_create_minors_recursive(pool);
spa_import_os(spa);
return (0);
}
@@ -6461,6 +6470,8 @@ spa_export_common(const char *pool, int new_state, nvlist_t **oldconfig,
}
export_spa:
spa_export_os(spa);
if (new_state == POOL_STATE_DESTROYED)
spa_event_notify(spa, NULL, NULL, ESC_ZFS_POOL_DESTROY);
else if (new_state == POOL_STATE_EXPORTED)