changeset 7687:1132fbaf0c27

6750475 can't boot off a mirrored root with a failed disk
author Lin Ling <Lin.Ling@Sun.COM>
date Wed, 24 Sep 2008 20:56:23 -0700
parents 288e3a11da64
children 2757e6e1bb2a
files usr/src/uts/common/fs/zfs/spa.c usr/src/uts/common/fs/zfs/vdev_disk.c
diffstat 2 files changed, 6 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- a/usr/src/uts/common/fs/zfs/spa.c	Wed Sep 24 20:20:15 2008 -0700
+++ b/usr/src/uts/common/fs/zfs/spa.c	Wed Sep 24 20:56:23 2008 -0700
@@ -2344,9 +2344,8 @@
 		if (nvlist_lookup_string(child[c], ZPOOL_CONFIG_DEVID,
 		    &cdevid) != 0)
 			return (EINVAL);
-		if (error = spa_check_rootconf(cpath, cdevid, NULL, &tmptxg))
-			return (error);
-		if (tmptxg > txg) {
+		if ((spa_check_rootconf(cpath, cdevid, NULL,
+		    &tmptxg) == 0) && (tmptxg > txg)) {
 			txg = tmptxg;
 			VERIFY(nvlist_lookup_string(child[c],
 			    ZPOOL_CONFIG_PATH, &bootpath) == 0);
--- a/usr/src/uts/common/fs/zfs/vdev_disk.c	Wed Sep 24 20:20:15 2008 -0700
+++ b/usr/src/uts/common/fs/zfs/vdev_disk.c	Wed Sep 24 20:56:23 2008 -0700
@@ -608,15 +608,13 @@
 	uint64_t s, size;
 	int l;
 	ddi_devid_t tmpdevid;
-	int error;
+	int error = -1;
 	char *minor_name;
 
 	/*
 	 * Read the device label and build the nvlist.
 	 */
-	error = ldi_open_by_name(devpath, FREAD, kcred, &vd_lh, zfs_li);
-
-	if (error && devid != NULL && ddi_devid_str_decode(devid, &tmpdevid,
+	if (devid != NULL && ddi_devid_str_decode(devid, &tmpdevid,
 	    &minor_name) == 0) {
 		error = ldi_open_by_devid(tmpdevid, minor_name,
 		    spa_mode, kcred, &vd_lh, zfs_li);
@@ -624,7 +622,8 @@
 		ddi_devid_str_free(minor_name);
 	}
 
-	if (error)
+	if (error && (error = ldi_open_by_name(devpath, FREAD, kcred, &vd_lh,
+	    zfs_li)))
 		return (error);
 
 	if (ldi_get_size(vd_lh, &s)) {