]> git.proxmox.com Git - mirror_zfs.git/commit
Update the behavior of mountpoint property
authorUmer Saleem <usaleem@ixsystems.com>
Tue, 5 Sep 2023 08:27:53 +0000 (13:27 +0500)
committerBrian Behlendorf <behlendorf1@llnl.gov>
Wed, 20 Sep 2023 00:15:24 +0000 (17:15 -0700)
commitbbac1d2977ec245ec063313c97ffc2356be07c20
tree5849f7e47affa3aa47230c02de62ad363568c2c6
parent7228ba1114024bb3564e272dded995cf1dd3efb4
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 <behlendorf1@llnl.gov>
Reviewed-by: Alexander Motin <mav@FreeBSD.org>
Reviewed-by: Ameer Hamza <ahamza@ixsystems.com>
Signed-off-by: Umer Saleem <usaleem@ixsystems.com>
Closes #15240
cmd/zfs/zfs_main.c
lib/libzfs/libzfs_changelist.c
tests/zfs-tests/tests/functional/cli_root/zfs_mount/zfs_mount_006_pos.ksh
tests/zfs-tests/tests/functional/cli_root/zfs_mount/zfs_mount_008_pos.ksh
tests/zfs-tests/tests/functional/cli_root/zfs_mount/zfs_mount_012_pos.ksh
tests/zfs-tests/tests/functional/cli_root/zfs_set/mountpoint_002_pos.ksh
tests/zfs-tests/tests/functional/cli_root/zfs_set/zfs_set_003_neg.ksh