* Mark the given vdev degraded. A degraded vdev is purely an indication to the * user that something is wrong. The vdev continues to operate as normal as far * as I/O is concerned. */
| 3686 | * as I/O is concerned. |
| 3687 | */ |
| 3688 | int |
| 3689 | vdev_degrade(spa_t *spa, uint64_t guid, vdev_aux_t aux) |
| 3690 | { |
| 3691 | vdev_t *vd; |
| 3692 | |
| 3693 | spa_vdev_state_enter(spa, SCL_NONE); |
| 3694 | |
| 3695 | if ((vd = spa_lookup_by_guid(spa, guid, B_TRUE)) == NULL) |
| 3696 | return (spa_vdev_state_exit(spa, NULL, SET_ERROR(ENODEV))); |
| 3697 | |
| 3698 | if (!vd->vdev_ops->vdev_op_leaf) |
| 3699 | return (spa_vdev_state_exit(spa, NULL, SET_ERROR(ENOTSUP))); |
| 3700 | |
| 3701 | /* |
| 3702 | * If the vdev is already faulted, then don't do anything. |
| 3703 | */ |
| 3704 | if (vd->vdev_faulted || vd->vdev_degraded) |
| 3705 | return (spa_vdev_state_exit(spa, NULL, 0)); |
| 3706 | |
| 3707 | vd->vdev_degraded = 1ULL; |
| 3708 | if (!vdev_is_dead(vd)) |
| 3709 | vdev_set_state(vd, B_FALSE, VDEV_STATE_DEGRADED, |
| 3710 | aux); |
| 3711 | |
| 3712 | return (spa_vdev_state_exit(spa, vd, 0)); |
| 3713 | } |
| 3714 | |
| 3715 | /* |
| 3716 | * Online the given vdev. |
no test coverage detected