diff usr/src/uts/common/fs/zfs/zfs_ioctl.c @ 6423:437422a29d3a

PSARC 2006/370 ZFS Boot Support 5008936 ZFS and/or zvol should support dumps 5070124 dumpadm -d /dev/... does not enforce block device requirement for savecore 6521468 ZFS Boot support Phase 2 6553503 bfu can't find 'rootdev' from /etc/vfstab on a zfs root filesystem 6574993 zfs_mountroot() may need to call clkset() to set the boot_time kstat 6633197 zvol should not permit newfs or createpool while it's in use by swap or dump 6661127 zfs_name_valid() does not support ZFS_TYPE_POOL 6684121 The changes to smf scripts for supporting canmount=noauto will cause a boot failure.
author gw25295
date Fri, 11 Apr 2008 18:36:28 -0700
parents 5c743b207bf9
children 903545192033
line wrap: on
line diff
--- a/usr/src/uts/common/fs/zfs/zfs_ioctl.c	Fri Apr 11 16:15:33 2008 -0700
+++ b/usr/src/uts/common/fs/zfs/zfs_ioctl.c	Fri Apr 11 18:36:28 2008 -0700
@@ -984,8 +984,8 @@
 {
 	spa_t *spa;
 	int error;
-	nvlist_t *config, **l2cache;
-	uint_t nl2cache;
+	nvlist_t *config, **l2cache, **spares;
+	uint_t nl2cache = 0, nspares = 0;
 
 	error = spa_open(zc->zc_name, &spa, FTAG);
 	if (error != 0)
@@ -996,13 +996,20 @@
 	(void) nvlist_lookup_nvlist_array(config, ZPOOL_CONFIG_L2CACHE,
 	    &l2cache, &nl2cache);
 
+	(void) nvlist_lookup_nvlist_array(config, ZPOOL_CONFIG_SPARES,
+	    &spares, &nspares);
+
 	/*
 	 * A root pool with concatenated devices is not supported.
-	 * Thus, can not add a device to a root pool with one device.
-	 * Allow for l2cache devices to be added.
+	 * Thus, can not add a device to a root pool.
+	 *
+	 * Intent log device can not be added to a rootpool because
+	 * during mountroot, zil is replayed, a seperated log device
+	 * can not be accessed during the mountroot time.
+	 *
+	 * l2cache and spare devices are ok to be added to a rootpool.
 	 */
-	if (spa->spa_root_vdev->vdev_children == 1 && spa->spa_bootfs != 0 &&
-	    nl2cache == 0) {
+	if (spa->spa_bootfs != 0 && nl2cache == 0 && nspares == 0) {
 		spa_close(spa, FTAG);
 		return (EDOM);
 	}
@@ -1348,7 +1355,7 @@
 	return (error);
 }
 
-static int
+int
 zfs_set_prop_nvlist(const char *name, nvlist_t *nvl)
 {
 	nvpair_t *elem;
@@ -1919,6 +1926,7 @@
 
 	default:
 		cbfunc = NULL;
+		break;
 	}
 	if (strchr(zc->zc_name, '@') ||
 	    strchr(zc->zc_name, '%'))
@@ -2040,6 +2048,7 @@
 		error = dmu_objset_create(zc->zc_name, type, NULL, cbfunc,
 		    &zct);
 		nvlist_free(zct.zct_zplprops);
+
 	}
 
 	/*
@@ -2049,7 +2058,6 @@
 		if ((error = zfs_set_prop_nvlist(zc->zc_name, nvprops)) != 0)
 			(void) dmu_objset_destroy(zc->zc_name);
 	}
-
 	nvlist_free(nvprops);
 	return (error);
 }
@@ -2934,7 +2942,7 @@
 	zvol_close,	/* close */
 	zvol_strategy,	/* strategy */
 	nodev,		/* print */
-	nodev,		/* dump */
+	zvol_dump,	/* dump */
 	zvol_read,	/* read */
 	zvol_write,	/* write */
 	zfsdev_ioctl,	/* ioctl */