diff options
author | Brian Behlendorf <[email protected]> | 2020-08-18 22:13:17 -0700 |
---|---|---|
committer | GitHub <[email protected]> | 2020-08-18 22:13:17 -0700 |
commit | 5266a0728aae503fb2f79961299d4dffac58b22a (patch) | |
tree | d37cedb4ccf2b444d63b497ae1a3a6ffeccdb02c /cmd/zed/agents | |
parent | cfd59f904b0760f1bc909bc1b6deae9798042af9 (diff) |
ZED: Do not offline a missing device if no spare is available
Due to commit d48091d a removed device is now explicitly offlined by
the ZED if no spare is available, rather than the letting ZFS detect
it as UNAVAIL. This broke auto-replacing of whole-disk devices, as
described in issue #10577. In short, when a new device is reinserted
in the same slot, the ZED will try to ONLINE it without letting ZFS
recreate the necessary partition table.
This change simply avoids setting the device OFFLINE when removed if
no spare is available (or if spare_on_remove is false). This change
has been left minimal to allow it to be backported to 0.8.x release.
The auto_offline_001_pos ZTS test has been updated accordingly.
Some follow up work is planned to update the ZED so it transitions
the vdev to a REMOVED state. This is a state which has always
existed but there is no current interface the ZED can use to
accomplish this. Therefore it's being left to a follow up PR.
Reviewed-by: Gionatan Danti <[email protected]>
Co-authored-by: Gionatan Danti <[email protected]>
Signed-off-by: Brian Behlendorf <[email protected]>
Closes #10577
Closes #10730
Diffstat (limited to 'cmd/zed/agents')
-rw-r--r-- | cmd/zed/agents/zfs_retire.c | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/cmd/zed/agents/zfs_retire.c b/cmd/zed/agents/zfs_retire.c index 665fb216d..9e95e20d5 100644 --- a/cmd/zed/agents/zfs_retire.c +++ b/cmd/zed/agents/zfs_retire.c @@ -351,9 +351,8 @@ zfs_retire_recv(fmd_hdl_t *hdl, fmd_event_t *ep, nvlist_t *nvl, zpool_vdev_offline(zhp, devname, B_TRUE); } else if (!fmd_prop_get_int32(hdl, "spare_on_remove") || replace_with_spare(hdl, zhp, vdev) == B_FALSE) { - /* Could not handle with spare: offline the device */ - fmd_hdl_debug(hdl, "zpool_vdev_offline '%s'", devname); - zpool_vdev_offline(zhp, devname, B_TRUE); + /* Could not handle with spare */ + fmd_hdl_debug(hdl, "no spare for '%s'", devname); } free(devname); |