svn commit: r333630 - head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs
Andriy Gapon
avg at FreeBSD.org
Tue May 15 13:27:30 UTC 2018
Author: avg
Date: Tue May 15 13:27:29 2018
New Revision: 333630
URL: https://svnweb.freebsd.org/changeset/base/333630
Log:
Fix 'zpool create -t <tempname>'
Creating a pool with a temporary name fails when we also specify custom
dataset properties: this is because we mistakenly call
zfs_set_prop_nvlist() on the "real" pool name which, as expected,
cannot be found because the SPA is present in the namespace with the
temporary name.
Fix this by specifying the correct pool name when setting the dataset
properties.
Author: loli10K <ezomori.nozomu at gmail.com>
Reviewed-by: Prakash Surya <prakash.surya at delphix.com>
Reviewed-by: Brian Behlendorf <behlendorf1 at llnl.gov>
Obtained from: ZFS on Linux, zfsonlinux/zfs at 4ceb8dd6fdfdde
MFC after: 1 week
Modified:
head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ioctl.c
Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ioctl.c
==============================================================================
--- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ioctl.c Tue May 15 13:19:00 2018 (r333629)
+++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ioctl.c Tue May 15 13:27:29 2018 (r333630)
@@ -1556,6 +1556,7 @@ zfs_ioc_pool_create(zfs_cmd_t *zc)
nvlist_t *config, *props = NULL;
nvlist_t *rootprops = NULL;
nvlist_t *zplprops = NULL;
+ char *spa_name = zc->zc_name;
if (error = get_nvlist(zc->zc_nvlist_conf, zc->zc_nvlist_conf_size,
zc->zc_iflags, &config))
@@ -1571,6 +1572,7 @@ zfs_ioc_pool_create(zfs_cmd_t *zc)
if (props) {
nvlist_t *nvl = NULL;
uint64_t version = SPA_VERSION;
+ char *tname;
(void) nvlist_lookup_uint64(props,
zpool_prop_to_name(ZPOOL_PROP_VERSION), &version);
@@ -1593,6 +1595,10 @@ zfs_ioc_pool_create(zfs_cmd_t *zc)
zplprops, NULL);
if (error != 0)
goto pool_props_bad;
+
+ if (nvlist_lookup_string(props,
+ zpool_prop_to_name(ZPOOL_PROP_TNAME), &tname) == 0)
+ spa_name = tname;
}
error = spa_create(zc->zc_name, config, props, zplprops);
@@ -1600,9 +1606,9 @@ zfs_ioc_pool_create(zfs_cmd_t *zc)
/*
* Set the remaining root properties
*/
- if (!error && (error = zfs_set_prop_nvlist(zc->zc_name,
+ if (!error && (error = zfs_set_prop_nvlist(spa_name,
ZPROP_SRC_LOCAL, rootprops, NULL)) != 0)
- (void) spa_destroy(zc->zc_name);
+ (void) spa_destroy(spa_name);
pool_props_bad:
nvlist_free(rootprops);
More information about the svn-src-head
mailing list