From owner-svn-src-head@FreeBSD.ORG Sun May 23 21:02:44 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 3D6621065672; Sun, 23 May 2010 21:02:44 +0000 (UTC) (envelope-from mm@FreeBSD.org) Received: from svn.freebsd.org (unknown [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 2BB568FC18; Sun, 23 May 2010 21:02:44 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o4NL2i57089773; Sun, 23 May 2010 21:02:44 GMT (envelope-from mm@svn.freebsd.org) Received: (from mm@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o4NL2iVl089770; Sun, 23 May 2010 21:02:44 GMT (envelope-from mm@svn.freebsd.org) Message-Id: <201005232102.o4NL2iVl089770@svn.freebsd.org> From: Martin Matuska Date: Sun, 23 May 2010 21:02:44 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r208472 - in head: cddl/contrib/opensolaris/lib/libzfs/common sys/cddl/contrib/opensolaris/uts/common/fs/zfs X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 23 May 2010 21:02:44 -0000 Author: mm Date: Sun May 23 21:02:43 2010 New Revision: 208472 URL: http://svn.freebsd.org/changeset/base/208472 Log: Fix zfs receive temporarily changing unchanged stream properties. Fix possible panic with zfs_enable_datasets. OpenSolaris onnv revision: 8536:33bd5de3260e Approved by: pjd, delphij (mentor) Obtained from: OpenSolaris (Bug ID 6748561, 6757075) MFC after: 3 days Modified: head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_mount.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ioctl.c Modified: head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_mount.c ============================================================================== --- head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_mount.c Sun May 23 20:28:06 2010 (r208471) +++ head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_mount.c Sun May 23 21:02:43 2010 (r208472) @@ -20,7 +20,7 @@ */ /* - * Copyright 2008 Sun Microsystems, Inc. All rights reserved. + * Copyright 2009 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ @@ -1209,10 +1209,12 @@ zpool_enable_datasets(zpool_handle_t *zh /* * And mount all the datasets, keeping track of which ones - * succeeded or failed. By using zfs_alloc(), the good pointer - * will always be non-NULL. + * succeeded or failed. */ - good = zfs_alloc(zhp->zpool_hdl, cb.cb_used * sizeof (int)); + if ((good = zfs_alloc(zhp->zpool_hdl, + cb.cb_used * sizeof (int))) == NULL) + goto out; + ret = 0; for (i = 0; i < cb.cb_used; i++) { if (zfs_mount(cb.cb_datasets[i], mntopts, flags) != 0) Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ioctl.c ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ioctl.c Sun May 23 20:28:06 2010 (r208471) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ioctl.c Sun May 23 21:02:43 2010 (r208472) @@ -92,7 +92,7 @@ typedef struct zfs_ioc_vec { boolean_t zvec_his_log; } zfs_ioc_vec_t; -static void clear_props(char *dataset, nvlist_t *props); +static void clear_props(char *dataset, nvlist_t *props, nvlist_t *newprops); static int zfs_fill_zplprops_root(uint64_t, nvlist_t *, nvlist_t *, boolean_t *); int zfs_set_prop_nvlist(const char *, nvlist_t *); @@ -1645,7 +1645,7 @@ zfs_ioc_set_prop(zfs_cmd_t *zc) if (dmu_objset_open(zc->zc_name, DMU_OST_ANY, DS_MODE_USER | DS_MODE_READONLY, &os) == 0) { if (dsl_prop_get_all(os, &origprops, TRUE) == 0) { - clear_props(zc->zc_name, origprops); + clear_props(zc->zc_name, origprops, nvl); nvlist_free(origprops); } dmu_objset_close(os); @@ -2425,7 +2425,7 @@ zfs_ioc_rename(zfs_cmd_t *zc) } static void -clear_props(char *dataset, nvlist_t *props) +clear_props(char *dataset, nvlist_t *props, nvlist_t *newprops) { zfs_cmd_t *zc; nvpair_t *prop; @@ -2436,6 +2436,9 @@ clear_props(char *dataset, nvlist_t *pro (void) strcpy(zc->zc_name, dataset); for (prop = nvlist_next_nvpair(props, NULL); prop; prop = nvlist_next_nvpair(props, prop)) { + if (newprops != NULL && + nvlist_exists(newprops, nvpair_name(prop))) + continue; (void) strcpy(zc->zc_value, nvpair_name(prop)); if (zfs_secpolicy_inherit(zc, CRED()) == 0) (void) zfs_ioc_inherit_prop(zc); @@ -2543,7 +2546,7 @@ zfs_ioc_recv(zfs_cmd_t *zc) * so that the properties are applied to the new data. */ if (props) { - clear_props(tofs, origprops); + clear_props(tofs, origprops, props); /* * XXX - Note, this is all-or-nothing; should be best-effort. */ @@ -2582,7 +2585,7 @@ zfs_ioc_recv(zfs_cmd_t *zc) * On error, restore the original props. */ if (error && props) { - clear_props(tofs, props); + clear_props(tofs, props, NULL); (void) zfs_set_prop_nvlist(tofs, origprops); } out: