]> git.proxmox.com Git - mirror_zfs.git/commitdiff
zpool: guard vs_noalloc and vs_pspace with VDEV_STAT_VALID()
authorнаб <nabijaczleweli@nabijaczleweli.xyz>
Thu, 5 May 2022 16:45:12 +0000 (18:45 +0200)
committerGitHub <noreply@github.com>
Thu, 5 May 2022 16:45:12 +0000 (09:45 -0700)
Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Ahelenia Ziemiańska <nabijaczleweli@nabijaczleweli.xyz>
Closes #13412

cmd/zpool/zpool_main.c

index 043b6a2264621e5f228f84db75a5bb24d9489a20..aa61ff7c94244530412fca1b102a3c8d30b8bdc8 100644 (file)
@@ -2472,7 +2472,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)"));
        }
 
@@ -6162,7 +6162,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