summaryrefslogtreecommitdiffstats
path: root/lib/libzfs
diff options
context:
space:
mode:
authorChunwei Chen <[email protected]>2017-08-14 14:28:43 -0700
committerBrian Behlendorf <[email protected]>2018-06-28 14:49:17 -0700
commitedf60b864505497dc8c4f09d4ce2190c72f1e2c2 (patch)
tree25a0377164459fb001a530cd49ec025a7c7e4388 /lib/libzfs
parent69830602de2d836013a91bd42cc8d36bbebb3aae (diff)
Enforce PROP_ONETIME on zpool properties
Reviewed-by: Brian Behlendorf <[email protected]> Signed-off-by: Chunwei Chen <[email protected]> Closes #7661
Diffstat (limited to 'lib/libzfs')
-rw-r--r--lib/libzfs/libzfs_pool.c17
1 files changed, 8 insertions, 9 deletions
diff --git a/lib/libzfs/libzfs_pool.c b/lib/libzfs/libzfs_pool.c
index e8c0cdfe4..8f2eedec8 100644
--- a/lib/libzfs/libzfs_pool.c
+++ b/lib/libzfs/libzfs_pool.c
@@ -549,6 +549,14 @@ zpool_valid_proplist(libzfs_handle_t *hdl, const char *poolname,
goto error;
}
+ if (!flags.create && zpool_prop_setonce(prop)) {
+ zfs_error_aux(hdl, dgettext(TEXT_DOMAIN,
+ "property '%s' can only be set at "
+ "creation time"), propname);
+ (void) zfs_error(hdl, EZFS_BADPROP, errbuf);
+ goto error;
+ }
+
if (zprop_parse_value(hdl, elem, prop, ZFS_TYPE_POOL, retprops,
&strval, &intval, errbuf) != 0)
goto error;
@@ -704,15 +712,6 @@ zpool_valid_proplist(libzfs_handle_t *hdl, const char *poolname,
goto error;
}
break;
- case ZPOOL_PROP_TNAME:
- if (!flags.create) {
- zfs_error_aux(hdl, dgettext(TEXT_DOMAIN,
- "property '%s' can only be set at "
- "creation time"), propname);
- (void) zfs_error(hdl, EZFS_BADPROP, errbuf);
- goto error;
- }
- break;
case ZPOOL_PROP_MULTIHOST:
if (get_system_hostid() == 0) {
zfs_error_aux(hdl, dgettext(TEXT_DOMAIN,