aboutsummaryrefslogtreecommitdiffstats
path: root/cmd/zpool
diff options
context:
space:
mode:
authorilovezfs <[email protected]>2014-10-03 22:20:43 -0700
committerBrian Behlendorf <[email protected]>2014-10-23 10:00:35 -0700
commit023bbe6f017380f4a04c5060feb24dd8cdda9fce (patch)
treeabde4f4f766ffd721b335f37651841d460df209b /cmd/zpool
parent5f6d0b6f5aa9af2ee5be74ac415a574b732c2c0f (diff)
Fix zpool create -t ENOENT bug.
In userland we need to switch over to the temporary name once the pool has been created, otherwise the root dataset won't mount and the error "cannot open 'the_real_name': dataset does not exist" is printed. Signed-off-by: ilovezfs <[email protected]> Signed-off-by: Brian Behlendorf <[email protected]> Closes #2760
Diffstat (limited to 'cmd/zpool')
-rw-r--r--cmd/zpool/zpool_main.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/cmd/zpool/zpool_main.c b/cmd/zpool/zpool_main.c
index 3b5d2fc42..2b6ff4a65 100644
--- a/cmd/zpool/zpool_main.c
+++ b/cmd/zpool/zpool_main.c
@@ -814,6 +814,7 @@ zpool_do_create(int argc, char **argv)
int c;
nvlist_t *nvroot = NULL;
char *poolname;
+ char *tname = NULL;
int ret = 1;
char *altroot = NULL;
char *mountpoint = NULL;
@@ -914,6 +915,7 @@ zpool_do_create(int argc, char **argv)
if (add_prop_list_default(zpool_prop_to_name(
ZPOOL_PROP_CACHEFILE), "none", &props, B_TRUE))
goto errout;
+ tname = optarg;
break;
case ':':
(void) fprintf(stderr, gettext("missing argument for "
@@ -1086,8 +1088,8 @@ zpool_do_create(int argc, char **argv)
ret = 1;
if (zpool_create(g_zfs, poolname,
nvroot, props, fsprops) == 0) {
- zfs_handle_t *pool = zfs_open(g_zfs, poolname,
- ZFS_TYPE_FILESYSTEM);
+ zfs_handle_t *pool = zfs_open(g_zfs,
+ tname ? tname : poolname, ZFS_TYPE_FILESYSTEM);
if (pool != NULL) {
if (zfs_mount(pool, NULL, 0) == 0)
ret = zfs_shareall(pool);