diff options
author | LOLi <[email protected]> | 2016-11-29 20:22:38 +0100 |
---|---|---|
committer | Brian Behlendorf <[email protected]> | 2016-11-29 12:22:38 -0700 |
commit | 2f71caf2d926249920d1b9162550c56715cc6461 (patch) | |
tree | f970d0355d9a315d16aac3afc138f2af229b1f8f /lib/libshare | |
parent | 251cb8dfacb51b9ad7a0e3da305c0bc5bbc1cb9e (diff) |
Allow zfs unshare <protocol> -a
Allow `zfs unshare <protocol> -a` command to share or unshare all datasets
of a given protocol, nfs or smb.
Additionally, enable most of ZFS Test Suite zfs_share/zfs_unshare test cases.
To work around some Illumos-specific functionalities ($SHARE/$UNSHARE) some
function wrappers were added around them.
Finally, fix and issue in smb_is_share_active() that would leave SMB shares
exported when invoking 'zfs unshare -a'
Reviewed-by: Giuseppe Di Natale <[email protected]>
Reviewed-by: Brian Behlendorf <[email protected]>
Signed-off-by: Turbo Fredriksson <[email protected]>
Signed-off-by: loli10K <[email protected]>
Closes #3238
Closes #5367
Diffstat (limited to 'lib/libshare')
-rw-r--r-- | lib/libshare/smb.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/lib/libshare/smb.c b/lib/libshare/smb.c index f8b7118a3..343586508 100644 --- a/lib/libshare/smb.c +++ b/lib/libshare/smb.c @@ -354,17 +354,19 @@ smb_validate_shareopts(const char *shareopts) static boolean_t smb_is_share_active(sa_share_impl_t impl_share) { + smb_share_t *iter = smb_shares; + if (!smb_available()) return (B_FALSE); /* Retrieve the list of (possible) active shares */ smb_retrieve_shares(); - while (smb_shares != NULL) { - if (strcmp(impl_share->sharepath, smb_shares->path) == 0) + while (iter != NULL) { + if (strcmp(impl_share->sharepath, iter->path) == 0) return (B_TRUE); - smb_shares = smb_shares->next; + iter = iter->next; } return (B_FALSE); |