mirror of
https://git.proxmox.com/git/mirror_zfs.git
synced 2026-05-26 20:22:14 +03:00
spa_misc: add an API for spa_namespace_lock
This is useful as debugging support, as it lets namespace lock operations be traced directly. It will also be useful for future work to reduce the use of spa_namespace_lock, traditionally a source of difficult deadlocks. Sponsored-by: Klara, Inc. Sponsored-by: Wasabi Technology, Inc. Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov> Reviewed-by: Tony Hutter <hutter2@llnl.gov> Signed-off-by: Rob Norris <rob.norris@klarasystems.com> Closes #17906
This commit is contained in:
committed by
Brian Behlendorf
parent
e305c7d596
commit
ac0bc4cc00
@@ -193,7 +193,7 @@ spa_import_rootpool(const char *name, bool checkpointrewind)
|
||||
*/
|
||||
config = spa_generate_rootconf(name);
|
||||
|
||||
mutex_enter(&spa_namespace_lock);
|
||||
spa_namespace_enter(FTAG);
|
||||
if (config != NULL) {
|
||||
pname = fnvlist_lookup_string(config, ZPOOL_CONFIG_POOL_NAME);
|
||||
VERIFY0(strcmp(name, pname));
|
||||
@@ -204,7 +204,7 @@ spa_import_rootpool(const char *name, bool checkpointrewind)
|
||||
* e.g., after reboot -r.
|
||||
*/
|
||||
if (spa->spa_state == POOL_STATE_ACTIVE) {
|
||||
mutex_exit(&spa_namespace_lock);
|
||||
spa_namespace_exit(FTAG);
|
||||
fnvlist_free(config);
|
||||
return (0);
|
||||
}
|
||||
@@ -226,7 +226,7 @@ spa_import_rootpool(const char *name, bool checkpointrewind)
|
||||
&spa->spa_ubsync.ub_version) != 0)
|
||||
spa->spa_ubsync.ub_version = SPA_VERSION_INITIAL;
|
||||
} else if ((spa = spa_lookup(name)) == NULL) {
|
||||
mutex_exit(&spa_namespace_lock);
|
||||
spa_namespace_exit(FTAG);
|
||||
fnvlist_free(config);
|
||||
cmn_err(CE_NOTE, "Cannot find the pool label for '%s'",
|
||||
name);
|
||||
@@ -249,7 +249,7 @@ spa_import_rootpool(const char *name, bool checkpointrewind)
|
||||
VDEV_ALLOC_ROOTPOOL);
|
||||
spa_config_exit(spa, SCL_ALL, FTAG);
|
||||
if (error) {
|
||||
mutex_exit(&spa_namespace_lock);
|
||||
spa_namespace_exit(FTAG);
|
||||
fnvlist_free(config);
|
||||
cmn_err(CE_NOTE, "Can not parse the config for pool '%s'",
|
||||
name);
|
||||
@@ -259,7 +259,7 @@ spa_import_rootpool(const char *name, bool checkpointrewind)
|
||||
spa_config_enter(spa, SCL_ALL, FTAG, RW_WRITER);
|
||||
vdev_free(rvd);
|
||||
spa_config_exit(spa, SCL_ALL, FTAG);
|
||||
mutex_exit(&spa_namespace_lock);
|
||||
spa_namespace_exit(FTAG);
|
||||
|
||||
fnvlist_free(config);
|
||||
return (0);
|
||||
|
||||
Reference in New Issue
Block a user