On Tue, Jan 28, 2014 at 08:33:36AM -0800, Daniel Schepler wrote: > On Tuesday, January 28, 2014 09:37:36 PM Craig Small wrote: > > tags 736628 help > > tags 736628 upstream > > > > On Mon, Jan 27, 2014 at 09:08:56AM -0800, Daniel Schepler wrote: > > > (gdb) p disks > > > $1 = (struct disk_stat **) 0x7fffffffeb08 > > > (gdb) p *disks > > > $2 = (struct disk_stat *) 0x0 > > > (gdb) p cDisk > > > > The problem seems to be that a partition is found before the disk > > appears. More specifically, the partition needs to be before *any* > > disk. (A different but related bug is that the library assumes > > all partitions appear immediately after the disk line). > > > > So: sda, sda1, sda2 = ok > > sda1,sda2,sda = crash > > sr0, sda1, sda2 = ok, but sda1 is "linked" to sr0
Applying upstream patch check-presence-disks-in-vmstat.patch seems to fix the issue. As of today, this patch does not seem to be applied to version in sid 1:3.3.9-4. Regards, -- Hector Oron
From 5a34ff0a99a3c5e7ba4f7982d5de3d0dcc9e3045 Mon Sep 17 00:00:00 2001 From: Craig Small <[email protected]> Date: Wed, 29 Jan 2014 22:22:11 +1100 Subject: [PATCH] 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 --- proc/sysinfo.c | 7 +++++-- testsuite/vmstat.test/vmstat.exp | 22 +++++++++++++++------- 2 files changed, 20 insertions(+), 9 deletions(-) Index: procps-3.3.9/proc/sysinfo.c =================================================================== --- procps-3.3.9.orig/proc/sysinfo.c 2014-04-15 18:39:33.434652190 +0200 +++ procps-3.3.9/proc/sysinfo.c 2014-04-15 18:39:33.434652190 +0200 @@ -938,8 +938,11 @@ &(*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++; + } } } Index: procps-3.3.9/testsuite/vmstat.test/vmstat.exp =================================================================== --- procps-3.3.9.orig/testsuite/vmstat.test/vmstat.exp 2014-04-15 18:39:33.434652190 +0200 +++ procps-3.3.9/testsuite/vmstat.test/vmstat.exp 2014-04-15 18:41:49.798647367 +0200 @@ -26,16 +26,23 @@ } set test "vmstat disk information (-d option)" -#spawn $vmstat -d -#expect_pass "$test" "^disk\[ -\]+reads\[ -\]+writes\[ -\]+IO\[ -\]+\\s+total\\s+merged\\s+sectors\\s+ms\\s+total\\s+merged\\s+sectors\\s+ms\\s+cur\\s+sec\\s+" -untested "$test" +if { [ file readable "/sys/block" ] == 0 } { + unsupported "$test /sys/block not readable" +} else { + spawn $vmstat -d + expect_pass "$test" "^disk\[ -\]+reads\[ -\]+writes\[ -\]+IO\[ -\]+\\s+total\\s+merged\\s+sectors\\s+ms\\s+total\\s+merged\\s+sectors\\s+ms\\s+cur\\s+sec\\s+" +} # Need a partition set diskstats [ exec cat /proc/diskstats ] -if [ regexp "\\s+\\d+\\s+\\d+\\s+\(\[a-z\]+\\d+\)\\s+\[0-9\]\[0-9\]+" $diskstats line partition == 1 ] { - set test "vmstat partition (using $partition)" - spawn $vmstat -p $partition - expect_pass "$test" "^${partition}\\s+reads" +if { [ file readable "/sys/block" ] == 0 } { + unsupported "vmstat partition /sys/block not readable" } else { - unsupported "vmstat partition (cannot find partition)" + if [ regexp "\\s+\\d+\\s+\\d+\\s+\(\[a-z\]+\\d+\)\\s+\[0-9\]\[0-9\]+" $diskstats line partition == 1 ] { + set test "vmstat partition (using $partition)" + spawn $vmstat -p $partition + expect_pass "$test" "^${partition}\\s+reads" + } else { + unsupported "vmstat partition (cannot find partition)" + } }
signature.asc
Description: Digital signature

