diff options
author | Tony Hutter <[email protected]> | 2022-09-23 10:24:19 -0700 |
---|---|---|
committer | GitHub <[email protected]> | 2022-09-23 10:24:19 -0700 |
commit | e9b12d4196c07cc26e8c9b1826f6d091617cae53 (patch) | |
tree | 7086ee4dd88b756240e8f7f0439a5ca9a04c9843 /cmd/zpool | |
parent | ce55d6ae4689057a657986fcd9ea4c95cadb6381 (diff) |
zpool: Don't print "repairing" on force faulted drives
If you force fault a drive that's resilvering, it's scan stats can get
frozen in time, giving the false impression that it's being resilvered.
This commit checks the vdev state to see if the vdev is healthy before
reporting "resilvering" or "repairing" in zpool status.
Reviewed-by: Brian Behlendorf <[email protected]>
Signed-off-by: Tony Hutter <[email protected]>
Closes #13927
Closes #13930
Diffstat (limited to 'cmd/zpool')
-rw-r--r-- | cmd/zpool/zpool_main.c | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/cmd/zpool/zpool_main.c b/cmd/zpool/zpool_main.c index b5b0beef5..f412c82f9 100644 --- a/cmd/zpool/zpool_main.c +++ b/cmd/zpool/zpool_main.c @@ -2462,7 +2462,14 @@ print_status_config(zpool_handle_t *zhp, status_cbdata_t *cb, const char *name, (void) nvlist_lookup_uint64_array(root, ZPOOL_CONFIG_SCAN_STATS, (uint64_t **)&ps, &c); - if (ps != NULL && ps->pss_state == DSS_SCANNING && children == 0) { + /* + * If you force fault a drive that's resilvering, its scan stats can + * get frozen in time, giving the false impression that it's + * being resilvered. That's why we check the state to see if the vdev + * is healthy before reporting "resilvering" or "repairing". + */ + if (ps != NULL && ps->pss_state == DSS_SCANNING && children == 0 && + vs->vs_state == VDEV_STATE_HEALTHY) { if (vs->vs_scan_processed != 0) { (void) printf(gettext(" (%s)"), (ps->pss_func == POOL_SCAN_RESILVER) ? @@ -2474,7 +2481,7 @@ print_status_config(zpool_handle_t *zhp, status_cbdata_t *cb, const char *name, /* The top-level vdevs have the rebuild stats */ if (vrs != NULL && vrs->vrs_state == VDEV_REBUILD_ACTIVE && - children == 0) { + children == 0 && vs->vs_state == VDEV_STATE_HEALTHY) { if (vs->vs_rebuild_processed != 0) { (void) printf(gettext(" (resilvering)")); } |