From 497fc3519799aa8813f184c4e3c3ec271e981574 Mon Sep 17 00:00:00 2001 From: Sebastien Godard Date: Sun, 27 Feb 2011 16:07:59 +0100 Subject: [PATCH] iostat incorrectly mapped device-mapper IDs greater than 256. This is now fixed [DEBIAN Bug#614397]. Mail from Robert Luberda (22/02/2011) Subject: Fwd: Bug#614397: iostat(from sysstat) doesn't support more than 256 device-mapper names Sebastien, I'm forwarding a bug report I've got yesterday. I can't reproduce it by myself, as I don't use LVM at all, but I've just found out that some Debian machines actually do use it, and the device numbers on them starts with 252, so the contents of /dev/mapper looks like: crw-rw---- 1 root root 10, 61 Feb 19 18:43 control brw-rw---- 1 root disk 252, 0 Feb 19 18:43 vg_$hostname-srv Regards, robert ------ Wiadomosc oryginalna ------ Temat: Bug#614397: iostat(from sysstat) doesn't support more than 256 device-mapper names Odeslano-Data: Mon, 21 Feb 2011 18:27:01 +0000, Mon, 21 Feb 2011 18:27:04 +0000 Odeslano-Od: Adam Heath Odeslano-Do: debian-bugs-dist@lists.debian.org Odeslano-Kopia: Robert Luberda Data: Mon, 21 Feb 2011 12:24:11 -0600 Nadawca: Adam Heath Odpowiedz-Do: Adam Heath , 614397@bugs.debian.org Adresat: submit@bugs.debian.org package: sysstat severity: minor version: 9.0.6.1-2 iostat tries to do bit-shifting of device ids; this is a big no-no. Attached patch at least fixes it for mapping of device-mapper names(iostat -N). I would love to have this go into stable-updates(squeeze), but can understand if it's not the type of change that normally would be allowed. The circumstances of this bug, cause device 256 to map to 0, 257 to map to 1, etc. debian-changes-9.0.6.1-2.1 --- sysstat-9.0.6.1.orig/ioconf.c +++ sysstat-9.0.6.1/ioconf.c @@ -500,8 +500,8 @@ char *transform_devmapname(unsigned int if (stat(filen, &aux) == 0) { /* Get its minor and major numbers */ - dm_major = ((aux.st_rdev >> 8) & 0xff); - dm_minor = (aux.st_rdev & 0xff); + dm_major = major(aux.st_rdev); + dm_minor = minor(aux.st_rdev); if ((dm_minor == minor) && (dm_major == major)) { dm_name = dp->d_name; --- CHANGES | 2 ++ ioconf.c | 4 ++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/CHANGES b/CHANGES index 7096aa3..ce33abf 100644 --- a/CHANGES +++ b/CHANGES @@ -10,6 +10,8 @@ xxxx/xx/xx: Version 10.0.0 - Sebastien Godard (sysstat orange.fr) * [Jan Kaluza]: Added --debuginfo option to cifsiostat and nfsiostat. * cifsiostat and nfsiostat manual pages updated. + * [Adam Heath]: iostat incorrectly mapped device-mapper IDs + greater than 256. This is now fixed [DEBIAN Bug#614397]. * Sysstat's commands option -V now displays the version number on stdout and returns 0 for the exit code. * sysstat_panic function is now defined only in DEBUG mode. diff --git a/ioconf.c b/ioconf.c index b6b9994..b388683 100644 --- a/ioconf.c +++ b/ioconf.c @@ -500,8 +500,8 @@ char *transform_devmapname(unsigned int major, unsigned int minor) if (stat(filen, &aux) == 0) { /* Get its minor and major numbers */ - dm_major = ((aux.st_rdev >> 8) & 0xff); - dm_minor = (aux.st_rdev & 0xff); + dm_major = major(aux.st_rdev); + dm_minor = minor(aux.st_rdev); if ((dm_minor == minor) && (dm_major == major)) { dm_name = dp->d_name; -- 2.40.0