From 7d0b81d24beed01cea2c89de0d51a999fb322e93 Mon Sep 17 00:00:00 2001 From: avg Date: Tue, 19 Sep 2017 08:43:45 +0000 Subject: MFC r321471: 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 --- sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa.c b/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa.c index 88dfe3b..369b284 100644 --- a/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa.c +++ b/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa.c @@ -4179,6 +4179,16 @@ spa_import_rootpool(const char *name) 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 * we just read in. -- cgit v1.1