From owner-svn-src-all@FreeBSD.ORG Wed Jul 9 08:17:09 2014 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id D686BF81; Wed, 9 Jul 2014 08:17:09 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id C3CF02FBB; Wed, 9 Jul 2014 08:17:09 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.8/8.14.8) with ESMTP id s698H99a058516; Wed, 9 Jul 2014 08:17:09 GMT (envelope-from delphij@svn.freebsd.org) Received: (from delphij@localhost) by svn.freebsd.org (8.14.8/8.14.8/Submit) id s698H9Rh058514; Wed, 9 Jul 2014 08:17:09 GMT (envelope-from delphij@svn.freebsd.org) Message-Id: <201407090817.s698H9Rh058514@svn.freebsd.org> From: Xin LI Date: Wed, 9 Jul 2014 08:17:09 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-vendor@freebsd.org Subject: svn commit: r268453 - vendor/illumos/dist/lib/libzfs/common X-SVN-Group: vendor MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 09 Jul 2014 08:17:10 -0000 Author: delphij Date: Wed Jul 9 08:17:09 2014 New Revision: 268453 URL: http://svnweb.freebsd.org/changeset/base/268453 Log: 4953 zfs rename need not involve libshare 4954 "zfs create" need not involve libshare if we are not sharing 4955 libshare's get_zfs_dataset need not sort the datasets Reviewed by: George Wilson Reviewed by: Sebastien Roy Reviewed by: Dan McDonald Reviewed by: Gordon Ross Approved by: Garrett D'Amore illumos/illumos-gate@33cde0d0c27645bc9ec94c4d2955193c3dd4027c Modified: vendor/illumos/dist/lib/libzfs/common/libzfs_dataset.c vendor/illumos/dist/lib/libzfs/common/libzfs_mount.c Modified: vendor/illumos/dist/lib/libzfs/common/libzfs_dataset.c ============================================================================== --- vendor/illumos/dist/lib/libzfs/common/libzfs_dataset.c Wed Jul 9 08:14:13 2014 (r268452) +++ vendor/illumos/dist/lib/libzfs/common/libzfs_dataset.c Wed Jul 9 08:17:09 2014 (r268453) @@ -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 } 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 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 * 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); Modified: vendor/illumos/dist/lib/libzfs/common/libzfs_mount.c ============================================================================== --- vendor/illumos/dist/lib/libzfs/common/libzfs_mount.c Wed Jul 9 08:14:13 2014 (r268452) +++ vendor/illumos/dist/lib/libzfs/common/libzfs_mount.c Wed Jul 9 08:17:09 2014 (r268453) @@ -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_s 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_s 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.