forked from openzfs/zfs
-
Notifications
You must be signed in to change notification settings - Fork 6
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
NAS-123279 / 23.10 / Improve the handling of mountpoint, sharesmb and sharenfs properties #167
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
zfs-share.service executes `zfs share` on every boot to share any filesystem/s, that are shared over SMB and/or NFS using the sharesmb and sharenfs properties. Since we do not rely on these properties to share over SMB and NFS and the service fails on boot on TrueNAS if sharesmb and/or sharenfs properties are set, and we rely on middleware to control the SMB and NFS shares, zfs-share.service should be disabled for TrueNAS SCALE. Signed-off-by: Umer Saleem <[email protected]>
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 openzfs#15240
For sharesmb and sharenfs properties, the status of setting the property is tied with whether we succeed to share the dataset or not. In case sharing the dataset is not successful, this is treated as overall failure of setting the property. In this case, if we check the property after the failure, it is set to on. This commit updates this behavior and the status of setting the share properties is not returned as failure, when we fail to share the dataset. For sharenfs property, if access list is provided, the syntax errors in access list/host adresses are not validated until after setting the property during postfix phase while trying to share the dataset. This is not correct, since the property has already been set when we reach there. Syntax errors in access list/host addresses are validated while validating the property list, before setting the property and failure is returned to user in this case when there are errors in access list. 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 openzfs#15240
ixhamza
approved these changes
Sep 20, 2023
amotin
approved these changes
Sep 20, 2023
Not updating JIRA ticket https://ixsystems.atlassian.net/browse/NAS-123279 target versions as no JIRA version corresponds to this PR |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Motivation and Context
There are some inconsistencies in the handling of
mountpoint
,sharesmb
andsharenfs
properties.
If
mountpoint
property is set when dataset is unmounted, this would update themountpoint
property. The mountpoint could be valid or invalid in this case. Setting the
mountpoint
propertywould result in success and dataset would still be unmounted here.
On the other hand, if dataset is mounted and
mountpoint
property is updated to somethinginvalid 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 andtries 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.
For
sharesmb
andsharenfs
properties, the status of setting the property is tied with whetherwe succeed to share the dataset or not. In case sharing the dataset is not successful, this is
treated as overall failure of setting the property. In this case, if we check the property after the
failure, it is set to on.
For
sharenfs
property, if access list is provided, the syntax errors in access list/host addressesare not validated until after setting the property during postfix phase while trying to share the
dataset. This is not correct, since the property has already been set when we reach there.
For TrueNAS SCALE,
zfs-share.service
executeszfs share -a
on every boot and fails toshare over SMB or NFS if
sharesmb
and/orsharenfs
are set, as we are handling shares inmiddleware differently.
Description
For
mountpoint
property, to make the behavior consistent in case dataset is mounted orunmounted, we should try to mount the dataset whenever
mountpoint
property is updated. Thiswould result in mounting the datasets if
canmount
property is set to on, regardless if the datasetwas previously unmounted.
The failure in mount operation while setting the
mountpoint
property should not be treated asfailure, since the property is actually set now to user requested value.
Similarly, for
sharenfs
andsharesmb
properties, the status of setting the share propertiesshould not be returned as failure, when we fail to share the dataset.
For
sharenfs
property, syntax errors in access list/host addresses are validated while validatingthe property list, before setting the property and failure is returned to user in this case when there
are errors in access list.
zfs-share.service
is now disabled since middleware is responsible for sharing over SMB andNFS.
How Has This Been Tested?
Manually tested by setting the properties and ran ZTS.
Types of changes
Checklist:
Signed-off-by
.