summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorAndrew Stormont <[email protected]>2017-06-12 17:56:09 +0100
committerBrian Behlendorf <[email protected]>2017-06-22 09:43:23 -0700
commit7e35ea783e55eaa4f0721d34077652b874f979d8 (patch)
tree735bc0e277fa11e29ea42246c0495317392b845c /lib
parent29eb4942856da942f1482cba9326698f91eb8c1c (diff)
OpenZFS 8331 - zfs_unshare returns wrong error code for smb unshare failure
Authored by: Andrew Stormont <[email protected]> Reviewed by: Marcel Telka <[email protected]> Reviewed by: Toomas Soome <[email protected]> Approved by: Dan McDonald <[email protected]> Reviewed-by: Brian Behlendorf <[email protected]> Reviewed-by: George Melikov <[email protected]> Ported-by: Giuseppe Di Natale <[email protected]> OpenZFS-issue: https://www.illumos.org/issues/8331 OpenZFS-commit: https://github.com/openzfs/openzfs/commit/4f4378c Closes #6255
Diffstat (limited to 'lib')
-rw-r--r--lib/libzfs/libzfs_mount.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/lib/libzfs/libzfs_mount.c b/lib/libzfs/libzfs_mount.c
index 781982a87..6296eb13a 100644
--- a/lib/libzfs/libzfs_mount.c
+++ b/lib/libzfs/libzfs_mount.c
@@ -24,6 +24,7 @@
* Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2014, 2015 by Delphix. All rights reserved.
* Copyright 2016 Igor Kozhukhov <[email protected]>
+ * Copyright 2017 RackTop Systems.
*/
/*
@@ -91,7 +92,7 @@ zfs_share_type_t zfs_is_shared_proto(zfs_handle_t *, char **,
zfs_share_proto_t);
/*
- * The share protocols table must be in the same order as the zfs_share_prot_t
+ * The share protocols table must be in the same order as the zfs_share_proto_t
* enum in libzfs_impl.h
*/
typedef struct {
@@ -936,7 +937,7 @@ unshare_one(libzfs_handle_t *hdl, const char *name, const char *mountpoint,
/* make sure libshare initialized */
if ((err = zfs_init_libshare(hdl, SA_INIT_SHARE_API)) != SA_OK) {
free(mntpt); /* don't need the copy anymore */
- return (zfs_error_fmt(hdl, EZFS_UNSHARENFSFAILED,
+ return (zfs_error_fmt(hdl, proto_table[proto].p_unshare_err,
dgettext(TEXT_DOMAIN, "cannot unshare '%s': %s"),
name, sa_errorstr(err)));
}
@@ -947,12 +948,13 @@ unshare_one(libzfs_handle_t *hdl, const char *name, const char *mountpoint,
if (share != NULL) {
err = sa_disable_share(share, proto_table[proto].p_name);
if (err != SA_OK) {
- return (zfs_error_fmt(hdl, EZFS_UNSHARENFSFAILED,
+ return (zfs_error_fmt(hdl,
+ proto_table[proto].p_unshare_err,
dgettext(TEXT_DOMAIN, "cannot unshare '%s': %s"),
name, sa_errorstr(err)));
}
} else {
- return (zfs_error_fmt(hdl, EZFS_UNSHARENFSFAILED,
+ return (zfs_error_fmt(hdl, proto_table[proto].p_unshare_err,
dgettext(TEXT_DOMAIN, "cannot unshare '%s': not found"),
name));
}