mirror of
https://git.proxmox.com/git/mirror_zfs.git
synced 2026-05-22 02:27:36 +03:00
Improve the handling of sharesmb,sharenfs properties
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 <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
This commit is contained in:
committed by
Brian Behlendorf
parent
e9dc31c74e
commit
c53bc3837c
@@ -174,7 +174,6 @@ changelist_postfix(prop_changelist_t *clp)
|
||||
prop_changenode_t *cn;
|
||||
uu_avl_walk_t *walk;
|
||||
char shareopts[ZFS_MAXPROPLEN];
|
||||
int errors = 0;
|
||||
boolean_t commit_smb_shares = B_FALSE;
|
||||
boolean_t commit_nfs_shares = B_FALSE;
|
||||
|
||||
@@ -262,19 +261,19 @@ changelist_postfix(prop_changelist_t *clp)
|
||||
const enum sa_protocol nfs[] =
|
||||
{SA_PROTOCOL_NFS, SA_NO_PROTOCOL};
|
||||
if (sharenfs && mounted) {
|
||||
errors += zfs_share(cn->cn_handle, nfs);
|
||||
zfs_share(cn->cn_handle, nfs);
|
||||
commit_nfs_shares = B_TRUE;
|
||||
} else if (cn->cn_shared || clp->cl_waslegacy) {
|
||||
errors += zfs_unshare(cn->cn_handle, NULL, nfs);
|
||||
zfs_unshare(cn->cn_handle, NULL, nfs);
|
||||
commit_nfs_shares = B_TRUE;
|
||||
}
|
||||
const enum sa_protocol smb[] =
|
||||
{SA_PROTOCOL_SMB, SA_NO_PROTOCOL};
|
||||
if (sharesmb && mounted) {
|
||||
errors += zfs_share(cn->cn_handle, smb);
|
||||
zfs_share(cn->cn_handle, smb);
|
||||
commit_smb_shares = B_TRUE;
|
||||
} else if (cn->cn_shared || clp->cl_waslegacy) {
|
||||
errors += zfs_unshare(cn->cn_handle, NULL, smb);
|
||||
zfs_unshare(cn->cn_handle, NULL, smb);
|
||||
commit_smb_shares = B_TRUE;
|
||||
}
|
||||
}
|
||||
@@ -288,7 +287,7 @@ changelist_postfix(prop_changelist_t *clp)
|
||||
zfs_commit_shares(proto);
|
||||
uu_avl_walk_end(walk);
|
||||
|
||||
return (errors ? -1 : 0);
|
||||
return (0);
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
Reference in New Issue
Block a user