From 976246fadde25790cec3de50c01c689d98d84e0c Mon Sep 17 00:00:00 2001 From: Don Brady Date: Mon, 7 Nov 2016 16:01:38 -0700 Subject: 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 Reviewed-by: Brian Behlendorf Signed-off-by: Don Brady Closes #5343 --- module/zfs/vdev.c | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'module/zfs/vdev.c') 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; } -- cgit v1.2.3