spa_import_rootpool should be able to handle an imported root pool

That is required to support reboot -r with a new root filesystem being
on an already imported pool.

PR:		210721
Reported by:	Jan Bramkamp <crest_maintainer@rlwinm.de>
MFC after:	2 weeks
This commit is contained in:
Andriy Gapon 2017-07-25 13:17:06 +00:00
parent 637ba06516
commit f6040f9e8e
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=321471

View File

@ -4269,6 +4269,16 @@ spa_import_rootpool(const char *name)
== 0);
if ((spa = spa_lookup(pname)) != NULL) {
/*
* The pool could already be imported,
* e.g., after reboot -r.
*/
if (spa->spa_state == POOL_STATE_ACTIVE) {
mutex_exit(&spa_namespace_lock);
nvlist_free(config);
return (0);
}
/*
* Remove the existing root pool from the namespace so
* that we can replace it with the correct config