mirror of
https://git.proxmox.com/git/mirror_zfs
synced 2025-04-28 11:40:17 +00:00
spa_sync_props: remove pool userprops by setting empty-string
People have noted there's no way to remove a pool userprop, only zero it. Turns vdev userprops had a method, by setting empty-string. So this makes pool userprops follow the same behaviour. Sponsored-by: Klara, Inc. Sponsored-by: Wasabi Technology, Inc. Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov> Reviewed-by: Alexander Motin <mav@FreeBSD.org> Signed-off-by: Rob Norris <rob.norris@klarasystems.com> Closes #16887
This commit is contained in:
parent
779c5a5deb
commit
03b7cfdef3
@ -9683,9 +9683,17 @@ spa_sync_props(void *arg, dmu_tx_t *tx)
|
||||
if (nvpair_type(elem) == DATA_TYPE_STRING) {
|
||||
ASSERT(proptype == PROP_TYPE_STRING);
|
||||
strval = fnvpair_value_string(elem);
|
||||
VERIFY0(zap_update(mos,
|
||||
spa->spa_pool_props_object, propname,
|
||||
1, strlen(strval) + 1, strval, tx));
|
||||
if (strlen(strval) == 0) {
|
||||
/* remove the property if value == "" */
|
||||
(void) zap_remove(mos,
|
||||
spa->spa_pool_props_object,
|
||||
propname, tx);
|
||||
} else {
|
||||
VERIFY0(zap_update(mos,
|
||||
spa->spa_pool_props_object,
|
||||
propname, 1, strlen(strval) + 1,
|
||||
strval, tx));
|
||||
}
|
||||
spa_history_log_internal(spa, "set", tx,
|
||||
"%s=%s", elemname, strval);
|
||||
} else if (nvpair_type(elem) == DATA_TYPE_UINT64) {
|
||||
|
Loading…
Reference in New Issue
Block a user