diff options
author | Tony Hutter <[email protected]> | 2017-05-19 12:30:16 -0700 |
---|---|---|
committer | Brian Behlendorf <[email protected]> | 2017-05-19 12:30:16 -0700 |
commit | 4a283c7f77eb5065e9f03b122bf8ead4f4a1e2be (patch) | |
tree | 2a4daf72ae62343aa7f24305a592fc2f31bb2eeb /module/zfs/spa_misc.c | |
parent | a32df59e187a6187eb96c52b93cf02e8af51f327 (diff) |
Force fault a vdev with 'zpool offline -f'
This patch adds a '-f' option to 'zpool offline' to fault a vdev
instead of bringing it offline. Unlike the OFFLINE state, the
FAULTED state will trigger the FMA code, allowing for things like
autoreplace and triggering the slot fault LED. The -f faults
persist across imports, unless they were set with the temporary
(-t) flag. Both persistent and temporary faults can be cleared
with zpool clear.
Reviewed-by: Brian Behlendorf <[email protected]>
Signed-off-by: Tony Hutter <[email protected]>
Closes #6094
Diffstat (limited to 'module/zfs/spa_misc.c')
-rw-r--r-- | module/zfs/spa_misc.c | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/module/zfs/spa_misc.c b/module/zfs/spa_misc.c index 831f83b33..fb425e121 100644 --- a/module/zfs/spa_misc.c +++ b/module/zfs/spa_misc.c @@ -1181,13 +1181,21 @@ int spa_vdev_state_exit(spa_t *spa, vdev_t *vd, int error) { boolean_t config_changed = B_FALSE; + vdev_t *vdev_top; + + if (vd == NULL || vd == spa->spa_root_vdev) { + vdev_top = spa->spa_root_vdev; + } else { + vdev_top = vd->vdev_top; + } if (vd != NULL || error == 0) - vdev_dtl_reassess(vd ? vd->vdev_top : spa->spa_root_vdev, - 0, 0, B_FALSE); + vdev_dtl_reassess(vdev_top, 0, 0, B_FALSE); if (vd != NULL) { - vdev_state_dirty(vd->vdev_top); + if (vd != spa->spa_root_vdev) + vdev_state_dirty(vdev_top); + config_changed = B_TRUE; spa->spa_config_generation++; } |