mirror of
https://git.proxmox.com/git/mirror_zfs.git
synced 2026-05-27 04:32:16 +03:00
Add '-u' - nomount flag for zfs set
This commit adds '-u' flag for zfs set operation. With this flag, mountpoint, sharenfs and sharesmb properties can be updated without actually mounting or sharing the dataset. Previously, if dataset was unmounted, and mountpoint property was updated, dataset was not mounted after the update. This behavior is changed in #15240. We mount the dataset whenever mountpoint property is updated, regardless if it's mounted or not. To provide the user with option to keep the dataset unmounted and still update the mountpoint without mounting the dataset, '-u' flag can be used. If any of mountpoint, sharenfs or sharesmb properties are updated with '-u' flag, the property is set to desired value but the operation to (re/un)mount and/or (re/un)share the dataset is not performed and dataset remains as it was before. Reviewed-by: Alexander Motin <mav@FreeBSD.org> Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov> Signed-off-by: Umer Saleem <usaleem@ixsystems.com> Closes #15322
This commit is contained in:
@@ -1771,14 +1771,24 @@ error:
|
||||
return (ret);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* Given an nvlist of property names and values, set the properties for the
|
||||
* given dataset.
|
||||
*/
|
||||
int
|
||||
zfs_prop_set_list(zfs_handle_t *zhp, nvlist_t *props)
|
||||
{
|
||||
return (zfs_prop_set_list_flags(zhp, props, 0));
|
||||
}
|
||||
|
||||
/*
|
||||
* Given an nvlist of property names, values and flags, set the properties
|
||||
* for the given dataset. If ZFS_SET_NOMOUNT is set, it allows to update
|
||||
* mountpoint, sharenfs and sharesmb properties without (un/re)mounting
|
||||
* and (un/re)sharing the dataset.
|
||||
*/
|
||||
int
|
||||
zfs_prop_set_list_flags(zfs_handle_t *zhp, nvlist_t *props, int flags)
|
||||
{
|
||||
zfs_cmd_t zc = {"\0"};
|
||||
int ret = -1;
|
||||
@@ -1848,7 +1858,9 @@ zfs_prop_set_list(zfs_handle_t *zhp, nvlist_t *props)
|
||||
if (prop != ZFS_PROP_CANMOUNT ||
|
||||
(fnvpair_value_uint64(elem) == ZFS_CANMOUNT_OFF &&
|
||||
zfs_is_mounted(zhp, NULL))) {
|
||||
cls[cl_idx] = changelist_gather(zhp, prop, 0, 0);
|
||||
cls[cl_idx] = changelist_gather(zhp, prop,
|
||||
((flags & ZFS_SET_NOMOUNT) ?
|
||||
CL_GATHER_DONT_UNMOUNT : 0), 0);
|
||||
if (cls[cl_idx] == NULL)
|
||||
goto error;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user