aboutsummaryrefslogtreecommitdiffstats
path: root/cmd
diff options
context:
space:
mode:
authorUmer Saleem <[email protected]>2023-09-05 13:27:53 +0500
committerBrian Behlendorf <[email protected]>2023-09-19 17:15:24 -0700
commitbbac1d2977ec245ec063313c97ffc2356be07c20 (patch)
tree5849f7e47affa3aa47230c02de62ad363568c2c6 /cmd
parent7228ba1114024bb3564e272dded995cf1dd3efb4 (diff)
Update the behavior of mountpoint property
There are some inconsistencies in the handling of mountpoint property. This commit updates the behavior and makes it consistent. If mountpoint property is set when dataset is unmounted, this would update the mountpoint property. The mountpoint could be valid or invalid in this case. Setting the mountpoint property would result in success in this case. Dataset would still be unmounted here. On the other hand, if dataset is mounted and mountpoint property is updated to something invalid where mount cannot be successful, for example, setting the mountpoint inside a readonly directory. This would unmount the dataset, set the mountpoint property to requested value and tries to mount the dataset. The mount operation returns error and this error is treated as overall failure of setting the property while the property is actually set. To make the behavior consistent in case dataset is mounted or unmounted, we should try to mount the dataset whenever mountpoint property is updated. This would result in mounting the datasets if canmount property is set to on, regardless if the dataset was previously unmounted. The failure in mount operation while setting the mountpoint property should not be treated as failure, since the property is actually set now to user requested value. Reviewed-by: Brian Behlendorf <[email protected]> Reviewed-by: Alexander Motin <[email protected]> Reviewed-by: Ameer Hamza <[email protected]> Signed-off-by: Umer Saleem <[email protected]> Closes #15240
Diffstat (limited to 'cmd')
-rw-r--r--cmd/zfs/zfs_main.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/cmd/zfs/zfs_main.c b/cmd/zfs/zfs_main.c
index 629e04887..45cd2998d 100644
--- a/cmd/zfs/zfs_main.c
+++ b/cmd/zfs/zfs_main.c
@@ -4207,8 +4207,9 @@ static int
set_callback(zfs_handle_t *zhp, void *data)
{
nvlist_t *props = data;
+ int ret = zfs_prop_set_list(zhp, props);
- if (zfs_prop_set_list(zhp, props) != 0) {
+ if (ret != 0 || libzfs_errno(g_zfs) != EZFS_SUCCESS) {
switch (libzfs_errno(g_zfs)) {
case EZFS_MOUNTFAILED:
(void) fprintf(stderr, gettext("property may be set "
@@ -4217,11 +4218,11 @@ set_callback(zfs_handle_t *zhp, void *data)
case EZFS_SHARENFSFAILED:
(void) fprintf(stderr, gettext("property may be set "
"but unable to reshare filesystem\n"));
+ ret = 1;
break;
}
- return (1);
}
- return (0);
+ return (ret);
}
static int