changeset 12793:4f82f6b1fb30

6962440 disable ZFS_PROP_SHARESMB on zoneroot dataset
author batschul <Frank.Batschulat@Sun.COM>
date Wed, 07 Jul 2010 00:31:35 -0700
parents 9ae1c153bab6
children 39cdfef4d699
files usr/src/cmd/zoneadm/zfs.c
diffstat 1 files changed, 21 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- a/usr/src/cmd/zoneadm/zfs.c	Tue Jul 06 23:02:45 2010 -0700
+++ b/usr/src/cmd/zoneadm/zfs.c	Wed Jul 07 00:31:35 2010 -0700
@@ -20,8 +20,7 @@
  */
 
 /*
- * Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
- * Use is subject to license terms.
+ * Copyright (c) 2006, 2010, Oracle and/or its affiliates. All rights reserved.
  */
 
 /*
@@ -398,9 +397,16 @@
 
 	(void) printf(gettext("Cloning snapshot %s\n"), snapshot_name);
 
-	if (nvlist_alloc(&props, NV_UNIQUE_NAME, 0) != 0 ||
-	    nvlist_add_string(props, zfs_prop_to_name(ZFS_PROP_SHARENFS),
-	    "off") != 0) {
+	/*
+	 * We turn off zfs SHARENFS and SHARESMB properties on the
+	 * zoneroot dataset in order to prevent the GZ from sharing
+	 * NGZ data by accident.
+	 */
+	if ((nvlist_alloc(&props, NV_UNIQUE_NAME, 0) != 0) ||
+	    (nvlist_add_string(props, zfs_prop_to_name(ZFS_PROP_SHARENFS),
+	    "off") != 0) ||
+	    (nvlist_add_string(props, zfs_prop_to_name(ZFS_PROP_SHARESMB),
+	    "off") != 0)) {
 		if (props != NULL)
 			nvlist_free(props);
 		(void) fprintf(stderr, gettext("could not create ZFS clone "
@@ -998,9 +1004,16 @@
 		return;
 	}
 
-	if (nvlist_alloc(&props, NV_UNIQUE_NAME, 0) != 0 ||
-	    nvlist_add_string(props, zfs_prop_to_name(ZFS_PROP_SHARENFS),
-	    "off") != 0) {
+	/*
+	 * We turn off zfs SHARENFS and SHARESMB properties on the
+	 * zoneroot dataset in order to prevent the GZ from sharing
+	 * NGZ data by accident.
+	 */
+	if ((nvlist_alloc(&props, NV_UNIQUE_NAME, 0) != 0) ||
+	    (nvlist_add_string(props, zfs_prop_to_name(ZFS_PROP_SHARENFS),
+	    "off") != 0) ||
+	    (nvlist_add_string(props, zfs_prop_to_name(ZFS_PROP_SHARESMB),
+	    "off") != 0)) {
 		if (props != NULL)
 			nvlist_free(props);
 		(void) fprintf(stderr, gettext("cannot create ZFS dataset %s: "