aboutsummaryrefslogtreecommitdiffstats
path: root/module
diff options
context:
space:
mode:
authorloli10K <[email protected]>2018-09-18 23:45:52 +0200
committerBrian Behlendorf <[email protected]>2018-11-09 11:17:24 -0800
commitd48091de81e5eab2aa32d7a52db4f147bd813523 (patch)
treeafb0974ccc0d02287e4734d3142a900b6959758c /module
parent13c59bb76b2f56db9f3ff6597d8a865347158e2c (diff)
zed: detect and offline physically removed devices
This commit adds a new test case to the ZFS Test Suite to verify ZED can detect when a device is physically removed from a running system: the device will be offlined if a spare is not available in the pool. We implement this by using the existing libudev functionality and without relying solely on the FM kernel module capabilities which have been observed to be unreliable with some kernels. Reviewed-by: Brian Behlendorf <[email protected]> Reviewed-by: Don Brady <[email protected]> Signed-off-by: loli10K <[email protected]> Closes #1537 Closes #7926
Diffstat (limited to 'module')
-rw-r--r--module/zfs/vdev.c1
-rw-r--r--module/zfs/vdev_label.c4
2 files changed, 5 insertions, 0 deletions
diff --git a/module/zfs/vdev.c b/module/zfs/vdev.c
index a99eb93a4..ff5a15365 100644
--- a/module/zfs/vdev.c
+++ b/module/zfs/vdev.c
@@ -3424,6 +3424,7 @@ vdev_online(spa_t *spa, uint64_t guid, uint64_t flags, vdev_state_t *newstate)
for (pvd = vd; pvd != rvd; pvd = pvd->vdev_parent)
pvd->vdev_expanding = !!((flags & ZFS_ONLINE_EXPAND) ||
spa->spa_autoexpand);
+ vd->vdev_expansion_time = gethrestime_sec();
}
vdev_reopen(tvd);
diff --git a/module/zfs/vdev_label.c b/module/zfs/vdev_label.c
index b3425cf26..f99085146 100644
--- a/module/zfs/vdev_label.c
+++ b/module/zfs/vdev_label.c
@@ -515,6 +515,10 @@ vdev_config_generate(spa_t *spa, vdev_t *vd, boolean_t getstats,
if (vd->vdev_crtxg)
fnvlist_add_uint64(nv, ZPOOL_CONFIG_CREATE_TXG, vd->vdev_crtxg);
+ if (vd->vdev_expansion_time)
+ fnvlist_add_uint64(nv, ZPOOL_CONFIG_EXPANSION_TIME,
+ vd->vdev_expansion_time);
+
if (flags & VDEV_CONFIG_MOS) {
if (vd->vdev_leaf_zap != 0) {
ASSERT(vd->vdev_ops->vdev_op_leaf);