summaryrefslogtreecommitdiff
path: root/usr/src
diff options
context:
space:
mode:
authorAndrew Stormont <astormont@racktopsystems.com>2021-06-25 16:22:17 +0100
committerAndrew Stormont <astormont@racktopsystems.com>2021-07-29 16:21:07 +0100
commitca706442e611a88ef5cbcd5deab686390a75263b (patch)
treed25cbdabe45da2bb89fd886c284e7c4fad8f4d65 /usr/src
parent35fa020436971e0d663866b134eff23b6f45d32c (diff)
downloadillumos-joyent-ca706442e611a88ef5cbcd5deab686390a75263b.tar.gz
13907 diskinfo fails and exits on the first bad disk
Reviewed by: Andy Fiddaman <andy@omnios.org> Reviewed by: Yuri Pankov <ypankov@tintri.com> Approved by: Robert Mustacchi <rm@fingolfin.org>
Diffstat (limited to 'usr/src')
-rw-r--r--usr/src/cmd/diskinfo/diskinfo.c11
1 files changed, 10 insertions, 1 deletions
diff --git a/usr/src/cmd/diskinfo/diskinfo.c b/usr/src/cmd/diskinfo/diskinfo.c
index ca09fe027e..f7b352c0e6 100644
--- a/usr/src/cmd/diskinfo/diskinfo.c
+++ b/usr/src/cmd/diskinfo/diskinfo.c
@@ -11,6 +11,7 @@
/*
* Copyright (c) 2018 Joyent Inc., All rights reserved.
+ * Copyright 2021 RackTop Systems, Inc.
*/
#include <sys/types.h>
@@ -270,7 +271,15 @@ enumerate_disks(di_opts_t *opts)
continue;
}
- mattrs = dm_get_attributes(media[i], &err);
+ /*
+ * The attributes depend on us being able to get the media
+ * info with DKIOCGMEDIAINFO which may not be the case for
+ * disks which are failing.
+ */
+ if ((mattrs = dm_get_attributes(media[i], &err)) == NULL) {
+ continue;
+ }
+
err = nvlist_lookup_uint64(mattrs, DM_SIZE, &size);
assert(err == 0);
err = nvlist_lookup_uint32(mattrs, DM_BLOCKSIZE, &blocksize);