summaryrefslogtreecommitdiffstats
path: root/module/zfs/vdev.c
diff options
context:
space:
mode:
authorDon Brady <[email protected]>2016-11-07 16:01:38 -0700
committerBrian Behlendorf <[email protected]>2016-11-07 15:01:38 -0800
commit976246fadde25790cec3de50c01c689d98d84e0c (patch)
tree13cf67895edeeae4c842bb08f69573189ba8a83d /module/zfs/vdev.c
parentf4bae2ed6361917660f5238cd35672ad18d7babc (diff)
Add illumos FMD ZFS logic to ZED -- phase 2
The phase 2 work primarily entails the Diagnosis Engine and the Retire Agent modules. It also includes infrastructure to support a crude FMD environment to host these modules. The Diagnosis Engine consumes I/O and checksum ereports and feeds them into a SERD engine which will generate a corres- ponding fault diagnosis when the SERD engine fires. All the diagnosis state data is collected into cases, one case per vdev being tracked. The Retire Agent responds to diagnosed faults by isolating the faulty VDEV. It will notify the ZFS kernel module of the new VDEV state (degraded or faulted). This agent is also responsible for managing hot spares across pools. When it encounters a device fault or a device removal it replaces the device with an appropriate spare if available. Reviewed-by: Tony Hutter <[email protected]> Reviewed-by: Brian Behlendorf <[email protected]> Signed-off-by: Don Brady <[email protected]> Closes #5343
Diffstat (limited to 'module/zfs/vdev.c')
-rw-r--r--module/zfs/vdev.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/module/zfs/vdev.c b/module/zfs/vdev.c
index c51ed43e6..db44d2ae1 100644
--- a/module/zfs/vdev.c
+++ b/module/zfs/vdev.c
@@ -3373,6 +3373,17 @@ vdev_set_state(vdev_t *vd, boolean_t isopen, vdev_state_t state, vdev_aux_t aux)
spa_t *spa = vd->vdev_spa;
if (state == vd->vdev_state) {
+ /*
+ * Since vdev_offline() code path is already in an offline
+ * state we can miss a statechange event to OFFLINE. Check
+ * the previous state to catch this condition.
+ */
+ if (vd->vdev_ops->vdev_op_leaf &&
+ (state == VDEV_STATE_OFFLINE) &&
+ (vd->vdev_prevstate >= VDEV_STATE_FAULTED)) {
+ /* post an offline state change */
+ zfs_post_state_change(spa, vd, vd->vdev_prevstate);
+ }
vd->vdev_stat.vs_aux = aux;
return;
}