From owner-svn-src-vendor@FreeBSD.ORG Tue Jun 25 21:44:49 2013 Return-Path: Delivered-To: svn-src-vendor@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 4790580; Tue, 25 Jun 2013 21:44:49 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 25FD218ED; Tue, 25 Jun 2013 21:44:49 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r5PLin0v064535; Tue, 25 Jun 2013 21:44:49 GMT (envelope-from delphij@svn.freebsd.org) Received: (from delphij@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r5PLimFX064533; Tue, 25 Jun 2013 21:44:48 GMT (envelope-from delphij@svn.freebsd.org) Message-Id: <201306252144.r5PLimFX064533@svn.freebsd.org> From: Xin LI Date: Tue, 25 Jun 2013 21:44:48 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-vendor@freebsd.org Subject: svn commit: r252215 - vendor-sys/illumos/dist/uts/common/fs/zfs vendor/illumos/dist/lib/libzfs/common vendor/illumos/dist/lib/libzfs_core/common X-SVN-Group: vendor MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-vendor@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the vendor work area tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 25 Jun 2013 21:44:49 -0000 Author: delphij Date: Tue Jun 25 21:44:48 2013 New Revision: 252215 URL: http://svnweb.freebsd.org/changeset/base/252215 Log: Update vendor/illumos/dist and vendor-sys/illumos/dist to illumos-gate 14060:aeb4e8fef072 Illumos ZFS issues: 3829 fix for 3740 changed behavior of zfs destroy/hold/release ioctl Modified: vendor/illumos/dist/lib/libzfs/common/libzfs_dataset.c vendor/illumos/dist/lib/libzfs_core/common/libzfs_core.c Changes in other areas also in this revision: Modified: vendor-sys/illumos/dist/uts/common/fs/zfs/dsl_destroy.c vendor-sys/illumos/dist/uts/common/fs/zfs/dsl_userhold.c Modified: vendor/illumos/dist/lib/libzfs/common/libzfs_dataset.c ============================================================================== --- vendor/illumos/dist/lib/libzfs/common/libzfs_dataset.c Tue Jun 25 21:43:49 2013 (r252214) +++ vendor/illumos/dist/lib/libzfs/common/libzfs_dataset.c Tue Jun 25 21:44:48 2013 (r252215) @@ -21,7 +21,7 @@ /* * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved. - * Copyright (c) 2012 by Delphix. All rights reserved. + * Copyright (c) 2013 by Delphix. All rights reserved. * Copyright (c) 2012 DEY Storage Systems, Inc. All rights reserved. * Copyright 2012 Nexenta Systems, Inc. All rights reserved. * Copyright (c) 2013 Martin Matuska. All rights reserved. @@ -4073,6 +4073,7 @@ struct holdarg { const char *snapname; const char *tag; boolean_t recursive; + int error; }; static int @@ -4200,15 +4201,20 @@ zfs_release_one(zfs_handle_t *zhp, void struct holdarg *ha = arg; char name[ZFS_MAXNAMELEN]; int rv = 0; + nvlist_t *existing_holds; (void) snprintf(name, sizeof (name), "%s@%s", zhp->zfs_name, ha->snapname); - if (lzc_exists(name)) { - nvlist_t *holds = fnvlist_alloc(); - fnvlist_add_boolean(holds, ha->tag); - fnvlist_add_nvlist(ha->nvl, name, holds); - fnvlist_free(holds); + if (lzc_get_holds(name, &existing_holds) != 0) { + ha->error = ENOENT; + } else if (!nvlist_exists(existing_holds, ha->tag)) { + ha->error = ESRCH; + } else { + nvlist_t *torelease = fnvlist_alloc(); + fnvlist_add_boolean(torelease, ha->tag); + fnvlist_add_nvlist(ha->nvl, name, torelease); + fnvlist_free(torelease); } if (ha->recursive) @@ -4232,16 +4238,21 @@ zfs_release(zfs_handle_t *zhp, const cha ha.snapname = snapname; ha.tag = tag; ha.recursive = recursive; + ha.error = 0; (void) zfs_release_one(zfs_handle_dup(zhp), &ha); if (nvlist_empty(ha.nvl)) { fnvlist_free(ha.nvl); - ret = ENOENT; + ret = ha.error; (void) snprintf(errbuf, sizeof (errbuf), dgettext(TEXT_DOMAIN, "cannot release hold from snapshot '%s@%s'"), zhp->zfs_name, snapname); - (void) zfs_standard_error(hdl, ret, errbuf); + if (ret == ESRCH) { + (void) zfs_error(hdl, EZFS_REFTAG_RELE, errbuf); + } else { + (void) zfs_standard_error(hdl, ret, errbuf); + } return (ret); } Modified: vendor/illumos/dist/lib/libzfs_core/common/libzfs_core.c ============================================================================== --- vendor/illumos/dist/lib/libzfs_core/common/libzfs_core.c Tue Jun 25 21:43:49 2013 (r252214) +++ vendor/illumos/dist/lib/libzfs_core/common/libzfs_core.c Tue Jun 25 21:44:48 2013 (r252215) @@ -255,11 +255,8 @@ lzc_snapshot(nvlist_t *snaps, nvlist_t * * marked for deferred destruction, and will be destroyed when the last hold * or clone is removed/destroyed. * - * The return value will be ENOENT if none of the snapshots existed. - * * The return value will be 0 if all snapshots were destroyed (or marked for - * later destruction if 'defer' is set) or didn't exist to begin with and - * at least one snapshot was destroyed. + * later destruction if 'defer' is set) or didn't exist to begin with. * * Otherwise the return value will be the errno of a (unspecified) snapshot * that failed, no snapshots will be destroyed, and the errlist will have an @@ -350,15 +347,10 @@ lzc_exists(const char *dataset) * or imported. * * Holds for snapshots which don't exist will be skipped and have an entry - * added to errlist, but will not cause an overall failure, except in the - * case that all holds where skipped. - * - * The return value will be ENOENT if none of the snapshots for the requested - * holds existed. + * added to errlist, but will not cause an overall failure. * - * The return value will be 0 if the nvl holds was empty or all holds, for - * snapshots that existed, were succesfully created and at least one hold - * was created. + * The return value will be 0 if all holds, for snapshots that existed, + * were succesfully created. * * Otherwise the return value will be the errno of a (unspecified) hold that * failed and no holds will be created. @@ -402,13 +394,10 @@ lzc_hold(nvlist_t *holds, int cleanup_fd * The value is a nvlist whose keys are the holds to remove. * * Holds which failed to release because they didn't exist will have an entry - * added to errlist, but will not cause an overall failure, except in the - * case that all releases where skipped. - * - * The return value will be ENOENT if none of the specified holds existed. + * added to errlist, but will not cause an overall failure. * * The return value will be 0 if the nvl holds was empty or all holds that - * existed, were successfully removed and at least one hold was removed. + * existed, were successfully removed. * * Otherwise the return value will be the errno of a (unspecified) hold that * failed to release and no holds will be released.