3825 (void) nvlist_lookup_string(props,
3826 zpool_prop_to_name(ZPOOL_PROP_ALTROOT), &altroot);
3827 (void) nvlist_lookup_uint64(props,
3828 zpool_prop_to_name(ZPOOL_PROP_READONLY), &readonly);
3829 if (readonly)
3830 mode = FREAD;
3831 spa = spa_add(pool, config, altroot);
3832 spa->spa_import_flags = flags;
3833
3834 /*
3835 * Verbatim import - Take a pool and insert it into the namespace
3836 * as if it had been loaded at boot.
3837 */
3838 if (spa->spa_import_flags & ZFS_IMPORT_VERBATIM) {
3839 if (props != NULL)
3840 spa_configfile_set(spa, props, B_FALSE);
3841
3842 spa_config_sync(spa, B_FALSE, B_TRUE);
3843
3844 mutex_exit(&spa_namespace_lock);
3845 spa_history_log_version(spa, "import");
3846
3847 return (0);
3848 }
3849
3850 spa_activate(spa, mode);
3851
3852 /*
3853 * Don't start async tasks until we know everything is healthy.
3854 */
3855 spa_async_suspend(spa);
3856
3857 zpool_get_rewind_policy(config, &policy);
3858 if (policy.zrp_request & ZPOOL_DO_REWIND)
3859 state = SPA_LOAD_RECOVER;
3860
3861 /*
3862 * Pass off the heavy lifting to spa_load(). Pass TRUE for mosconfig
3863 * because the user-supplied config is actually the one to trust when
3864 * doing an import.
3865 */
3866 if (state != SPA_LOAD_RECOVER)
|
3825 (void) nvlist_lookup_string(props,
3826 zpool_prop_to_name(ZPOOL_PROP_ALTROOT), &altroot);
3827 (void) nvlist_lookup_uint64(props,
3828 zpool_prop_to_name(ZPOOL_PROP_READONLY), &readonly);
3829 if (readonly)
3830 mode = FREAD;
3831 spa = spa_add(pool, config, altroot);
3832 spa->spa_import_flags = flags;
3833
3834 /*
3835 * Verbatim import - Take a pool and insert it into the namespace
3836 * as if it had been loaded at boot.
3837 */
3838 if (spa->spa_import_flags & ZFS_IMPORT_VERBATIM) {
3839 if (props != NULL)
3840 spa_configfile_set(spa, props, B_FALSE);
3841
3842 spa_config_sync(spa, B_FALSE, B_TRUE);
3843
3844 mutex_exit(&spa_namespace_lock);
3845 return (0);
3846 }
3847
3848 spa_activate(spa, mode);
3849
3850 /*
3851 * Don't start async tasks until we know everything is healthy.
3852 */
3853 spa_async_suspend(spa);
3854
3855 zpool_get_rewind_policy(config, &policy);
3856 if (policy.zrp_request & ZPOOL_DO_REWIND)
3857 state = SPA_LOAD_RECOVER;
3858
3859 /*
3860 * Pass off the heavy lifting to spa_load(). Pass TRUE for mosconfig
3861 * because the user-supplied config is actually the one to trust when
3862 * doing an import.
3863 */
3864 if (state != SPA_LOAD_RECOVER)
|