mirror of
https://git.proxmox.com/git/mirror_zfs.git
synced 2024-12-26 11:19:32 +03:00
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 <ilovezfs@icloud.com> Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov> Closes #2760
This commit is contained in:
parent
5f6d0b6f5a
commit
023bbe6f01
@ -814,6 +814,7 @@ zpool_do_create(int argc, char **argv)
|
|||||||
int c;
|
int c;
|
||||||
nvlist_t *nvroot = NULL;
|
nvlist_t *nvroot = NULL;
|
||||||
char *poolname;
|
char *poolname;
|
||||||
|
char *tname = NULL;
|
||||||
int ret = 1;
|
int ret = 1;
|
||||||
char *altroot = NULL;
|
char *altroot = NULL;
|
||||||
char *mountpoint = NULL;
|
char *mountpoint = NULL;
|
||||||
@ -914,6 +915,7 @@ zpool_do_create(int argc, char **argv)
|
|||||||
if (add_prop_list_default(zpool_prop_to_name(
|
if (add_prop_list_default(zpool_prop_to_name(
|
||||||
ZPOOL_PROP_CACHEFILE), "none", &props, B_TRUE))
|
ZPOOL_PROP_CACHEFILE), "none", &props, B_TRUE))
|
||||||
goto errout;
|
goto errout;
|
||||||
|
tname = optarg;
|
||||||
break;
|
break;
|
||||||
case ':':
|
case ':':
|
||||||
(void) fprintf(stderr, gettext("missing argument for "
|
(void) fprintf(stderr, gettext("missing argument for "
|
||||||
@ -1086,8 +1088,8 @@ zpool_do_create(int argc, char **argv)
|
|||||||
ret = 1;
|
ret = 1;
|
||||||
if (zpool_create(g_zfs, poolname,
|
if (zpool_create(g_zfs, poolname,
|
||||||
nvroot, props, fsprops) == 0) {
|
nvroot, props, fsprops) == 0) {
|
||||||
zfs_handle_t *pool = zfs_open(g_zfs, poolname,
|
zfs_handle_t *pool = zfs_open(g_zfs,
|
||||||
ZFS_TYPE_FILESYSTEM);
|
tname ? tname : poolname, ZFS_TYPE_FILESYSTEM);
|
||||||
if (pool != NULL) {
|
if (pool != NULL) {
|
||||||
if (zfs_mount(pool, NULL, 0) == 0)
|
if (zfs_mount(pool, NULL, 0) == 0)
|
||||||
ret = zfs_shareall(pool);
|
ret = zfs_shareall(pool);
|
||||||
|
Loading…
Reference in New Issue
Block a user