Failed to use all possible sd block device major number matches, which

led to false disk total/used reports, that is, totals less than used.
This commit is contained in:
Harald Hope 2021-01-28 20:58:58 -08:00
parent 287b8cfe77
commit 3a625f13ea
2 changed files with 6 additions and 1 deletions

4
inxi
View file

@ -9458,7 +9458,9 @@ sub proc_data {
# Note: with > 1 nvme drives, the minor number no longer passes the modulus tests, # Note: with > 1 nvme drives, the minor number no longer passes the modulus tests,
# It appears to just increase randomly from the first 0 minor of the first nvme to # It appears to just increase randomly from the first 0 minor of the first nvme to
# nvme partitions to next nvme, so it only passes the test for the first nvme drive. # nvme partitions to next nvme, so it only passes the test for the first nvme drive.
if ( $row->[0] =~ /^(3|8|22|33|43|179|202|252|253|254|259)$/ && # note: 66 16 9766436864 sdah ; 65 240 9766436864 sdaf[maybe special case when double letters?
# Check /proc/devices for major number matches
if ( $row->[0] =~ /^(3|8|22|33|43|6[5-9]|7[12]|12[89]|13[0-5]|179|202|252|253|254|259)$/ &&
$row->[-1] =~ /(mmcblk[0-9]+|n[b]?d[0-9]+|nvme[0-9]+n[0-9]+|fio[a-z]+|[hsv]d[a-z]+)$/ && $row->[-1] =~ /(mmcblk[0-9]+|n[b]?d[0-9]+|nvme[0-9]+n[0-9]+|fio[a-z]+|[hsv]d[a-z]+)$/ &&
( $row->[1] % 16 == 0 || $row->[1] % 16 == 8 || $row->[-1] =~ /(nvme[0-9]+n[0-9]+)$/) ) { ( $row->[1] % 16 == 0 || $row->[1] % 16 == 8 || $row->[-1] =~ /(nvme[0-9]+n[0-9]+)$/) ) {
$size += $row->[2]; $size += $row->[2];

View file

@ -25,6 +25,9 @@ for the drives but now it's fixed anyway. I had not realized that smartctl
made it plural when logical/physical were different, and singular when made it plural when logical/physical were different, and singular when
they were the same. they were the same.
4. Failed to use all possible sd block device major number matches, which
led to false disk total/used reports, that is, totals less than used.
Fixes: Fixes:
1. Going along with bug 2, fixed some other admin/non admin report glitches. 1. Going along with bug 2, fixed some other admin/non admin report glitches.
Made patterns more aggressively matching, whitelist based to avoid the types Made patterns more aggressively matching, whitelist based to avoid the types