mirror of
https://git.proxmox.com/git/mirror_zfs.git
synced 2026-05-22 02:27:36 +03:00
OpenZFS 9681 - ztest failure in spa_history_log_internal due to spa_rename()
Authored by: Matthew Ahrens <mahrens@delphix.com> Reviewed by: Prakash Surya <prakash.surya@delphix.com> Reviewed by: Serapheim Dimitropoulos <serapheim.dimitro@delphix.com> Reviewed by: George Melikov <mail@gmelikov.ru> Reviewed by: Tom Caputi <tcaputi@datto.com> Approved by: Robert Mustacchi <rm@joyent.com> Ported-by: Brian Behlendorf <behlendorf1@llnl.gov> OpenZFS-issue: https://www.illumos.org/issues/9681 OpenZFS-commit: https://github.com/openzfs/openzfs/commit/6aee0ad7 Closes #8041
This commit is contained in:
committed by
Brian Behlendorf
parent
80a91e7469
commit
d637db98e1
@@ -225,9 +225,6 @@
|
||||
* vdev state is protected by spa_vdev_state_enter() / spa_vdev_state_exit().
|
||||
* Like spa_vdev_enter/exit, these are convenience wrappers -- the actual
|
||||
* locking is, always, based on spa_namespace_lock and spa_config_lock[].
|
||||
*
|
||||
* spa_rename() is also implemented within this file since it requires
|
||||
* manipulation of the namespace.
|
||||
*/
|
||||
|
||||
static avl_tree_t spa_namespace_avl;
|
||||
@@ -1335,56 +1332,6 @@ spa_deactivate_mos_feature(spa_t *spa, const char *feature)
|
||||
vdev_config_dirty(spa->spa_root_vdev);
|
||||
}
|
||||
|
||||
/*
|
||||
* Rename a spa_t.
|
||||
*/
|
||||
int
|
||||
spa_rename(const char *name, const char *newname)
|
||||
{
|
||||
spa_t *spa;
|
||||
int err;
|
||||
|
||||
/*
|
||||
* Lookup the spa_t and grab the config lock for writing. We need to
|
||||
* actually open the pool so that we can sync out the necessary labels.
|
||||
* It's OK to call spa_open() with the namespace lock held because we
|
||||
* allow recursive calls for other reasons.
|
||||
*/
|
||||
mutex_enter(&spa_namespace_lock);
|
||||
if ((err = spa_open(name, &spa, FTAG)) != 0) {
|
||||
mutex_exit(&spa_namespace_lock);
|
||||
return (err);
|
||||
}
|
||||
|
||||
spa_config_enter(spa, SCL_ALL, FTAG, RW_WRITER);
|
||||
|
||||
avl_remove(&spa_namespace_avl, spa);
|
||||
(void) strlcpy(spa->spa_name, newname, sizeof (spa->spa_name));
|
||||
avl_add(&spa_namespace_avl, spa);
|
||||
|
||||
/*
|
||||
* Sync all labels to disk with the new names by marking the root vdev
|
||||
* dirty and waiting for it to sync. It will pick up the new pool name
|
||||
* during the sync.
|
||||
*/
|
||||
vdev_config_dirty(spa->spa_root_vdev);
|
||||
|
||||
spa_config_exit(spa, SCL_ALL, FTAG);
|
||||
|
||||
txg_wait_synced(spa->spa_dsl_pool, 0);
|
||||
|
||||
/*
|
||||
* Sync the updated config cache.
|
||||
*/
|
||||
spa_write_cachefile(spa, B_FALSE, B_TRUE);
|
||||
|
||||
spa_close(spa, FTAG);
|
||||
|
||||
mutex_exit(&spa_namespace_lock);
|
||||
|
||||
return (0);
|
||||
}
|
||||
|
||||
/*
|
||||
* Return the spa_t associated with given pool_guid, if it exists. If
|
||||
* device_guid is non-zero, determine whether the pool exists *and* contains
|
||||
@@ -2633,7 +2580,6 @@ EXPORT_SYMBOL(spa_maxblocksize);
|
||||
EXPORT_SYMBOL(spa_maxdnodesize);
|
||||
|
||||
/* Miscellaneous support routines */
|
||||
EXPORT_SYMBOL(spa_rename);
|
||||
EXPORT_SYMBOL(spa_guid_exists);
|
||||
EXPORT_SYMBOL(spa_strdup);
|
||||
EXPORT_SYMBOL(spa_strfree);
|
||||
|
||||
Reference in New Issue
Block a user