summaryrefslogtreecommitdiff
path: root/usr/src/uts/common/fs/zfs/vdev.c
diff options
context:
space:
mode:
authoreschrock <none@none>2007-01-08 11:15:07 -0800
committereschrock <none@none>2007-01-08 11:15:07 -0800
commit39c23413b8df94a95f67b34cfd4a4dfc3fd0b48d (patch)
treeeea889e04fa3d21b9bc5fe702a3eef1fc0148ebc /usr/src/uts/common/fs/zfs/vdev.c
parent3dba6097f91d71408b4a7c824521f8f0687ab6ff (diff)
downloadillumos-joyent-39c23413b8df94a95f67b34cfd4a4dfc3fd0b48d.tar.gz
6393525 vdev_reopen() should verify that it's still the same device
6414648 zfs allows overlapping devices to be added 6435943 assertion failed: spare != 0L, file: ../../common/fs/zfs/spa_misc.c 6436000 import of actively spared device returns EBUSY 6478316 nfs/server doesn't respect auto_enable setting 6483675 want a private property to return number of clones 6485728 zpool iostat should flush output periodically 6494072 A device which was set as spare disk is not detach 6497563 zfs double-spared an already-spared disk on reboot 6503724 adding spare that is in use in another pool should be allowed 6505225 zpool(1M) can give misleading error when removing active spare
Diffstat (limited to 'usr/src/uts/common/fs/zfs/vdev.c')
-rw-r--r--usr/src/uts/common/fs/zfs/vdev.c34
1 files changed, 22 insertions, 12 deletions
diff --git a/usr/src/uts/common/fs/zfs/vdev.c b/usr/src/uts/common/fs/zfs/vdev.c
index 007833e95e..0e96289ef4 100644
--- a/usr/src/uts/common/fs/zfs/vdev.c
+++ b/usr/src/uts/common/fs/zfs/vdev.c
@@ -20,7 +20,7 @@
*/
/*
- * Copyright 2006 Sun Microsystems, Inc. All rights reserved.
+ * Copyright 2007 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
@@ -328,7 +328,7 @@ vdev_free_common(vdev_t *vd)
spa_strfree(vd->vdev_devid);
if (vd->vdev_isspare)
- spa_spare_remove(vd->vdev_guid);
+ spa_spare_remove(vd);
txg_list_destroy(&vd->vdev_ms_list);
txg_list_destroy(&vd->vdev_dtl_list);
@@ -456,15 +456,6 @@ vdev_alloc(spa_t *spa, vdev_t **vdp, nvlist_t *nv, vdev_t *parent, uint_t id,
(void) nvlist_lookup_uint64(nv, ZPOOL_CONFIG_ASHIFT, &vd->vdev_ashift);
/*
- * Look for the 'is_spare' flag. If this is the case, then we are a
- * repurposed hot spare.
- */
- (void) nvlist_lookup_uint64(nv, ZPOOL_CONFIG_IS_SPARE,
- &vd->vdev_isspare);
- if (vd->vdev_isspare)
- spa_spare_add(vd->vdev_guid);
-
- /*
* If we're a top-level vdev, try to load the allocation parameters.
*/
if (parent && !parent->vdev_parent && alloctype == VDEV_ALLOC_LOAD) {
@@ -1019,6 +1010,22 @@ vdev_reopen(vdev_t *vd)
(void) vdev_open(vd);
/*
+ * Call vdev_validate() here to make sure we have the same device.
+ * Otherwise, a device with an invalid label could be successfully
+ * opened in response to vdev_reopen().
+ *
+ * The downside to this is that if the user is simply experimenting by
+ * overwriting an entire disk, we'll fault the device rather than
+ * demonstrate self-healing capabilities. On the other hand, with
+ * proper FMA integration, the series of errors we'd see from the device
+ * would result in a faulted device anyway. Given that this doesn't
+ * model any real-world corruption, it's better to catch this here and
+ * correctly identify that the device has either changed beneath us, or
+ * is corrupted beyond recognition.
+ */
+ (void) vdev_validate(vd);
+
+ /*
* Reassess root vdev's health.
*/
vdev_propagate_state(spa->spa_root_vdev);
@@ -1044,7 +1051,8 @@ vdev_create(vdev_t *vd, uint64_t txg, boolean_t isreplacing)
/*
* Recursively initialize all labels.
*/
- if ((error = vdev_label_init(vd, txg, isreplacing)) != 0) {
+ if ((error = vdev_label_init(vd, txg, isreplacing ?
+ VDEV_LABEL_REPLACE : VDEV_LABEL_CREATE)) != 0) {
vdev_close(vd);
return (error);
}
@@ -1325,6 +1333,8 @@ vdev_validate_spare(vdev_t *vd)
return (-1);
}
+ spa_spare_add(vd);
+
/*
* We don't actually check the pool state here. If it's in fact in
* use by another pool, we update this fact on the fly when requested.