Skip to content

Commit 0195da3

Browse files
committed
Do not lose properties when creating a pool with a temporary name
Some non-essential properties like mountpoint are lost during the creation of a temporary pool because will try to set them on the pool's permanent name, which does not exist inside the sPA namespace during pool creation. Most notably, the mountpoint property would be lost. Signed-off-by: Richard Yao <ryao@gentoo.org>
1 parent c569104 commit 0195da3

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

module/zfs/zfs_ioctl.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1449,6 +1449,7 @@ static int
14491449
zfs_ioc_pool_create(zfs_cmd_t *zc)
14501450
{
14511451
int error;
1452+
char *poolname = zc->zc_name;
14521453
nvlist_t *config, *props = NULL;
14531454
nvlist_t *rootprops = NULL;
14541455
nvlist_t *zplprops = NULL;
@@ -1493,10 +1494,12 @@ zfs_ioc_pool_create(zfs_cmd_t *zc)
14931494

14941495
error = spa_create(zc->zc_name, config, props, zplprops);
14951496

1497+
(void) nvlist_lookup_string(props, "tname", &poolname);
1498+
14961499
/*
14971500
* Set the remaining root properties
14981501
*/
1499-
if (!error && (error = zfs_set_prop_nvlist(zc->zc_name,
1502+
if (!error && (error = zfs_set_prop_nvlist(poolname,
15001503
ZPROP_SRC_LOCAL, rootprops, NULL)) != 0)
15011504
(void) spa_destroy(zc->zc_name);
15021505

0 commit comments

Comments
 (0)