Skip to content

Commit

Permalink
zpool: guard vs_noalloc and vs_pspace with VDEV_STAT_VALID()
Browse files Browse the repository at this point in the history
Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Ahelenia Ziemiańska <nabijaczleweli@nabijaczleweli.xyz>
Closes openzfs#13412
  • Loading branch information
nabijaczleweli authored and andrewc12 committed Sep 23, 2022
1 parent f154408 commit de46946
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions cmd/zpool/zpool_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -2474,7 +2474,7 @@ print_status_config(zpool_handle_t *zhp, status_cbdata_t *cb, const char *name,

if (vs->vs_scan_removing != 0) {
(void) printf(gettext(" (removing)"));
} else if (vs->vs_noalloc != 0) {
} else if (VDEV_STAT_VALID(vs_noalloc, vsc) && vs->vs_noalloc != 0) {
(void) printf(gettext(" (non-allocating)"));
}

Expand Down Expand Up @@ -6164,7 +6164,7 @@ print_list_stats(zpool_handle_t *zhp, const char *name, nvlist_t *nv,
* 'toplevel' boolean value is passed to the print_one_column()
* to indicate that the value is valid.
*/
if (vs->vs_pspace)
if (VDEV_STAT_VALID(vs_pspace, c) && vs->vs_pspace)
print_one_column(ZPOOL_PROP_SIZE, vs->vs_pspace, NULL,
scripted, B_TRUE, format);
else
Expand Down

0 comments on commit de46946

Please sign in to comment.