summaryrefslogtreecommitdiff
path: root/usr/src
diff options
context:
space:
mode:
Diffstat (limited to 'usr/src')
-rw-r--r--usr/src/lib/libshare/common/libshare_zfs.c2
-rw-r--r--usr/src/lib/libzfs/common/libzfs_dataset.c16
-rw-r--r--usr/src/lib/libzfs/common/libzfs_mount.c18
3 files changed, 18 insertions, 18 deletions
diff --git a/usr/src/lib/libshare/common/libshare_zfs.c b/usr/src/lib/libshare/common/libshare_zfs.c
index 7d3ee27a2d..ba65167594 100644
--- a/usr/src/lib/libshare/common/libshare_zfs.c
+++ b/usr/src/lib/libshare/common/libshare_zfs.c
@@ -24,6 +24,7 @@
*/
/*
* Copyright 2012 Nexenta Systems, Inc. All rights reserved.
+ * Copyright (c) 2012, 2014 by Delphix. All rights reserved.
*/
#include <stdio.h>
@@ -279,7 +280,6 @@ get_zfs_dataset(sa_handle_impl_t impl_handle, char *path,
char canmount[ZFS_MAXPROPLEN];
get_all_filesystems(impl_handle, &zlist, &count);
- qsort(zlist, count, sizeof (void *), mountpoint_compare);
for (i = 0; i < count; i++) {
/* must have a mountpoint */
if (zfs_prop_get(zlist[i], ZFS_PROP_MOUNTPOINT, mountpoint,
diff --git a/usr/src/lib/libzfs/common/libzfs_dataset.c b/usr/src/lib/libzfs/common/libzfs_dataset.c
index 7700cd3b3a..1a61d2694a 100644
--- a/usr/src/lib/libzfs/common/libzfs_dataset.c
+++ b/usr/src/lib/libzfs/common/libzfs_dataset.c
@@ -22,7 +22,7 @@
/*
* Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2013, Joyent, Inc. All rights reserved.
- * Copyright (c) 2013 by Delphix. All rights reserved.
+ * Copyright (c) 2011, 2014 by Delphix. All rights reserved.
* Copyright (c) 2012 DEY Storage Systems, Inc. All rights reserved.
* Copyright (c) 2013 Martin Matuska. All rights reserved.
* Copyright (c) 2013 Steven Hartland. All rights reserved.
@@ -3794,7 +3794,6 @@ zfs_rename(zfs_handle_t *zhp, const char *target, boolean_t recursive,
}
if (recursive) {
-
parentname = zfs_strdup(zhp->zfs_hdl, zhp->zfs_name);
if (parentname == NULL) {
ret = -1;
@@ -3807,8 +3806,7 @@ zfs_rename(zfs_handle_t *zhp, const char *target, boolean_t recursive,
ret = -1;
goto error;
}
-
- } else {
+ } else if (zhp->zfs_type != ZFS_TYPE_SNAPSHOT) {
if ((cl = changelist_gather(zhp, ZFS_PROP_NAME, 0,
force_unmount ? MS_FORCE : 0)) == NULL)
return (-1);
@@ -3856,23 +3854,23 @@ zfs_rename(zfs_handle_t *zhp, const char *target, boolean_t recursive,
* On failure, we still want to remount any filesystems that
* were previously mounted, so we don't alter the system state.
*/
- if (!recursive)
+ if (cl != NULL)
(void) changelist_postfix(cl);
} else {
- if (!recursive) {
+ if (cl != NULL) {
changelist_rename(cl, zfs_get_name(zhp), target);
ret = changelist_postfix(cl);
}
}
error:
- if (parentname) {
+ if (parentname != NULL) {
free(parentname);
}
- if (zhrp) {
+ if (zhrp != NULL) {
zfs_close(zhrp);
}
- if (cl) {
+ if (cl != NULL) {
changelist_free(cl);
}
return (ret);
diff --git a/usr/src/lib/libzfs/common/libzfs_mount.c b/usr/src/lib/libzfs/common/libzfs_mount.c
index 9222206204..7625a7d8e9 100644
--- a/usr/src/lib/libzfs/common/libzfs_mount.c
+++ b/usr/src/lib/libzfs/common/libzfs_mount.c
@@ -21,6 +21,7 @@
/*
* Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014 by Delphix. All rights reserved.
*/
/*
@@ -715,14 +716,6 @@ zfs_share_proto(zfs_handle_t *zhp, zfs_share_proto_t *proto)
if (!zfs_is_mountable(zhp, mountpoint, sizeof (mountpoint), NULL))
return (0);
- if ((ret = zfs_init_libshare(hdl, SA_INIT_SHARE_API)) != SA_OK) {
- (void) zfs_error_fmt(hdl, EZFS_SHARENFSFAILED,
- dgettext(TEXT_DOMAIN, "cannot share '%s': %s"),
- zfs_get_name(zhp), _sa_errorstr != NULL ?
- _sa_errorstr(ret) : "");
- return (-1);
- }
-
for (curr_proto = proto; *curr_proto != PROTO_END; curr_proto++) {
/*
* Return success if there are no share options.
@@ -733,6 +726,15 @@ zfs_share_proto(zfs_handle_t *zhp, zfs_share_proto_t *proto)
strcmp(shareopts, "off") == 0)
continue;
+ ret = zfs_init_libshare(hdl, SA_INIT_SHARE_API);
+ if (ret != SA_OK) {
+ (void) zfs_error_fmt(hdl, EZFS_SHARENFSFAILED,
+ dgettext(TEXT_DOMAIN, "cannot share '%s': %s"),
+ zfs_get_name(zhp), _sa_errorstr != NULL ?
+ _sa_errorstr(ret) : "");
+ return (-1);
+ }
+
/*
* If the 'zoned' property is set, then zfs_is_mountable()
* will have already bailed out if we are in the global zone.