summaryrefslogtreecommitdiffstats
path: root/cddl/contrib/opensolaris
diff options
context:
space:
mode:
authordelphij <delphij@FreeBSD.org>2014-07-09 20:57:42 +0000
committerdelphij <delphij@FreeBSD.org>2014-07-09 20:57:42 +0000
commitcb7e625917dd35e628dc02b563096d239afaba52 (patch)
treef028b38d936a5f94283b69e0d2780a5bbf0b3d4a /cddl/contrib/opensolaris
parent6391db200c3273b2395dc22e0c5586fea3dc892a (diff)
downloadFreeBSD-src-cb7e625917dd35e628dc02b563096d239afaba52.zip
FreeBSD-src-cb7e625917dd35e628dc02b563096d239afaba52.tar.gz
MFV r268453:
Diff reduction against Illumos. MFC after: 2 weeks
Diffstat (limited to 'cddl/contrib/opensolaris')
-rw-r--r--cddl/contrib/opensolaris/lib/libzfs/common/libzfs_dataset.c16
-rw-r--r--cddl/contrib/opensolaris/lib/libzfs/common/libzfs_mount.c22
2 files changed, 19 insertions, 19 deletions
diff --git a/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_dataset.c b/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_dataset.c
index 11378a2..d7126bf 100644
--- a/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_dataset.c
+++ b/cddl/contrib/opensolaris/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) 2011-2012 Pawel Jakub Dawidek <pawel@dawidek.net>.
* All rights reserved.
@@ -3873,7 +3873,6 @@ zfs_rename(zfs_handle_t *zhp, const char *source, const char *target,
strcmp(property, "none") == 0)) {
flags.nounmount = B_TRUE;
}
-
if (flags.recurse) {
parentname = zfs_strdup(zhp->zfs_hdl, zhp->zfs_name);
@@ -3888,8 +3887,7 @@ zfs_rename(zfs_handle_t *zhp, const char *source, const char *target,
ret = -1;
goto error;
}
-
- } else {
+ } else if (zhp->zfs_type != ZFS_TYPE_SNAPSHOT) {
if ((cl = changelist_gather(zhp, ZFS_PROP_NAME,
flags.nounmount ? CL_GATHER_DONT_UNMOUNT : 0,
flags.forceunmount ? MS_FORCE : 0)) == NULL) {
@@ -3941,23 +3939,23 @@ zfs_rename(zfs_handle_t *zhp, const char *source, const char *target,
* On failure, we still want to remount any filesystems that
* were previously mounted, so we don't alter the system state.
*/
- if (!flags.recurse)
+ if (cl != NULL)
(void) changelist_postfix(cl);
} else {
- if (!flags.recurse) {
+ 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/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_mount.c b/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_mount.c
index b2959dd..f8596ed 100644
--- a/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_mount.c
+++ b/cddl/contrib/opensolaris/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.
*/
/*
@@ -736,16 +737,6 @@ zfs_share_proto(zfs_handle_t *zhp, zfs_share_proto_t *proto)
if (!zfs_is_mountable(zhp, mountpoint, sizeof (mountpoint), NULL))
return (0);
-#ifdef sun
- 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);
- }
-#endif
-
for (curr_proto = proto; *curr_proto != PROTO_END; curr_proto++) {
/*
* Return success if there are no share options.
@@ -756,6 +747,17 @@ zfs_share_proto(zfs_handle_t *zhp, zfs_share_proto_t *proto)
strcmp(shareopts, "off") == 0)
continue;
+#ifdef illumos
+ 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);
+ }
+#endif
+
/*
* If the 'zoned' property is set, then zfs_is_mountable()
* will have already bailed out if we are in the global zone.
OpenPOWER on IntegriCloud