diskinfo fails and exits on the first bad disk
On one of our systems diskinfo fails with the following message:
Assertion failed: err == 0, file diskinfo.c, line 275, function enumerate_disks
It seems this is happening because dm_get_attributes is returning NULL in enumerate disks, which we pass to get nvlist_lookup_uint64 on line 274 and get EINVAL back, triggering the assert on line 275.
Digging deeper it seems this a result of media_read_info in libdiskmgmt returning NULL due to the DKIOCGMEDIAINFO ioctl failing on a bad disk we have in our system.
Updated by Andrew Stormont 11 months ago
I have a fix out for review here: https://code.illumos.org/c/illumos-gate/+/1572
Testing: without the fix diskinfo would crash consistently on our system with a bad disk. With the fix applied diskinfo no longer crashes and we get output from diskinfo for all the other disks.
Updated by Andrew Stormont 10 months ago
To clarify: when we encountered this issue the assert was the only output we got from diskinfo. I suspect that in other configurations you might get a few lines of output first.
With the change above applied we now get a list of disks, excluding the bad disk. This applies to all output modes.
Updated by Electric Monk 10 months ago
- Status changed from In Progress to Closed
- % Done changed from 0 to 100
commit ca706442e611a88ef5cbcd5deab686390a75263b Author: Andrew Stormont <firstname.lastname@example.org> Date: 2021-07-29T15:21:07.000Z 13907 diskinfo fails and exits on the first bad disk Reviewed by: Andy Fiddaman <email@example.com> Reviewed by: Yuri Pankov <firstname.lastname@example.org> Approved by: Robert Mustacchi <email@example.com>