diff options
author | Paul Dagnelie <[email protected]> | 2023-04-06 10:29:27 -0700 |
---|---|---|
committer | GitHub <[email protected]> | 2023-04-06 10:29:27 -0700 |
commit | b66c2a0899a71fce6454ff92e77e3838eafb27c8 (patch) | |
tree | 1f8231c2ba1a1318acde9dbbf2405232b93b30bb /cmd | |
parent | 1038f87c4edcc66d7d9446efb9b0d9ed50beda19 (diff) |
Storage device expansion "silently" fails on degraded vdev
When a vdev is degraded or faulted, we refuse to expand it when doing
online -e. However, we also don't actually cause the online command
to fail, even though the disk didn't expand. This is confusing and
misleading, and can result in violated expectations.
Reviewed-by: Brian Behlendorf <[email protected]>
Reviewed-by: Matthew Ahrens <[email protected]>
Reviewed-by: Mark Maybee <[email protected]>
Signed-off-by: Paul Dagnelie <[email protected]>
Closes 14145
Diffstat (limited to 'cmd')
-rw-r--r-- | cmd/zpool/zpool_main.c | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/cmd/zpool/zpool_main.c b/cmd/zpool/zpool_main.c index d79c1608b..9475beaa2 100644 --- a/cmd/zpool/zpool_main.c +++ b/cmd/zpool/zpool_main.c @@ -6936,6 +6936,17 @@ zpool_do_online(int argc, char **argv) return (1); for (i = 1; i < argc; i++) { + vdev_state_t oldstate; + boolean_t avail_spare, l2cache; + nvlist_t *tgt = zpool_find_vdev(zhp, argv[i], &avail_spare, + &l2cache, NULL); + if (tgt == NULL) { + ret = 1; + continue; + } + uint_t vsc; + oldstate = ((vdev_stat_t *)fnvlist_lookup_uint64_array(tgt, + ZPOOL_CONFIG_VDEV_STATS, &vsc))->vs_state; if (zpool_vdev_online(zhp, argv[i], flags, &newstate) == 0) { if (newstate != VDEV_STATE_HEALTHY) { (void) printf(gettext("warning: device '%s' " @@ -6949,6 +6960,17 @@ zpool_do_online(int argc, char **argv) (void) printf(gettext("use 'zpool " "replace' to replace devices " "that are no longer present\n")); + if ((flags & ZFS_ONLINE_EXPAND)) { + (void) printf(gettext("%s: failed " + "to expand usable space on " + "unhealthy device '%s'\n"), + (oldstate >= VDEV_STATE_DEGRADED ? + "error" : "warning"), argv[i]); + if (oldstate >= VDEV_STATE_DEGRADED) { + ret = 1; + break; + } + } } } else { ret = 1; |