From ca706442e611a88ef5cbcd5deab686390a75263b Mon Sep 17 00:00:00 2001 From: Andrew Stormont Date: Fri, 25 Jun 2021 16:22:17 +0100 Subject: 13907 diskinfo fails and exits on the first bad disk Reviewed by: Andy Fiddaman Reviewed by: Yuri Pankov Approved by: Robert Mustacchi --- usr/src/cmd/diskinfo/diskinfo.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'usr/src') 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 @@ -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); -- cgit v1.2.3