mirror of
https://git.proxmox.com/git/mirror_zfs.git
synced 2024-12-25 18:59:33 +03:00
Enforce PROP_ONETIME on zpool properties
Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov> Signed-off-by: Chunwei Chen <david.chen@osnexus.com> Closes #7661
This commit is contained in:
parent
69830602de
commit
edf60b8645
@ -320,6 +320,7 @@ const char *zpool_prop_to_name(zpool_prop_t);
|
||||
const char *zpool_prop_default_string(zpool_prop_t);
|
||||
uint64_t zpool_prop_default_numeric(zpool_prop_t);
|
||||
boolean_t zpool_prop_readonly(zpool_prop_t);
|
||||
boolean_t zpool_prop_setonce(zpool_prop_t);
|
||||
boolean_t zpool_prop_feature(const char *);
|
||||
boolean_t zpool_prop_unsupported(const char *);
|
||||
int zpool_prop_index_to_string(zpool_prop_t, uint64_t, const char **);
|
||||
|
@ -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,
|
||||
|
@ -171,6 +171,12 @@ zpool_prop_readonly(zpool_prop_t prop)
|
||||
return (zpool_prop_table[prop].pd_attr == PROP_READONLY);
|
||||
}
|
||||
|
||||
boolean_t
|
||||
zpool_prop_setonce(zpool_prop_t prop)
|
||||
{
|
||||
return (zpool_prop_table[prop].pd_attr == PROP_ONETIME);
|
||||
}
|
||||
|
||||
const char *
|
||||
zpool_prop_default_string(zpool_prop_t prop)
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user