Check for presence of disks in vmstat
vmstat -d or vmstat -p would crash mysteriously under different circumstances. The problem was eventually tracked down to /sys not being mounted which meant is_disk() always returned false. The partition would then be attempted to be linked to a non-existent disk causing a segfault. vmstat will now not link to a disk if none exists. The change in testing will skip those tests when /sys/block doesn't exist. Many thanks to Daniel Schepler for his analysis and suggestions. Bug-Debian: http://bugs.debian.org/736628
This commit is contained in:
@ -938,8 +938,11 @@ unsigned int getdiskstat(struct disk_stat **disks, struct partition_stat **parti
|
||||
&(*partitions)[cPartition].writes,
|
||||
&(*partitions)[cPartition].requested_writes
|
||||
);
|
||||
(*partitions)[cPartition++].parent_disk = cDisk-1;
|
||||
(*disks)[cDisk-1].partitions++;
|
||||
|
||||
if (cDisk > 0) {
|
||||
(*partitions)[cPartition++].parent_disk = cDisk-1;
|
||||
(*disks)[cDisk-1].partitions++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user