[net-snmp/f16] fixed units in hrStorageTable and hrFSTable Resolves: #789441

Jan Šafránek jsafrane at fedoraproject.org
Mon Oct 22 08:22:28 UTC 2012


commit d2a97c8a98f516941329282ce4bbbfb1ba7fcae9
Author: Jan Safranek <jsafrane at redhat.com>
Date:   Mon Oct 22 09:51:47 2012 +0200

    fixed units in hrStorageTable and hrFSTable
    Resolves: #789441

 net-snmp-5.7-hrStorage-units.patch |   51 ++++++++++++++++++++++++++++++++++++
 net-snmp.spec                      |    7 ++++-
 2 files changed, 57 insertions(+), 1 deletions(-)
---
diff --git a/net-snmp-5.7-hrStorage-units.patch b/net-snmp-5.7-hrStorage-units.patch
new file mode 100644
index 0000000..80cb828
--- /dev/null
+++ b/net-snmp-5.7-hrStorage-units.patch
@@ -0,0 +1,51 @@
+Bug 789441 - net-snmp reports incorrect used disk space for large filesystems
+
+From upstream git:
+
+commit 76ff25d9bf97579e7213102065fd5096f049a4c5
+Author: Bart Van Assche <bvanassche at acm.org>
+Date:   Fri Oct 7 14:13:18 2011 +0200
+
+    CHANGES: snmpd: HOST-RESOURCES-MIB::hrStorageTable: fix bug in handling large filesystems, where large means above 8 TB (= 2**31 * 4096 bytes).
+    
+    This patch fixes a bug introduced in commit
+    71d8293f387a6cd66bb0dbb13c0f50174d2e678b.
+    For the original bug report, see also
+    https://sourceforge.net/tracker/?func=detail&atid=112694&aid=3419825&group_id=12694.
+
+diff --git a/agent/mibgroup/hardware/fsys/hw_fsys.c b/agent/mibgroup/hardware/fsys/hw_fsys.c
+index c96284e..be698b2 100644
+--- a/agent/mibgroup/hardware/fsys/hw_fsys.c
++++ b/agent/mibgroup/hardware/fsys/hw_fsys.c
+@@ -321,19 +321,23 @@ netsnmp_fsys_avail( netsnmp_fsys_info *f) {
+ 
+ /* recalculate f->size_32, used_32, avail_32 and units_32 from f->size & comp.*/
+ void
+-netsnmp_fsys_calculate32( netsnmp_fsys_info *f)
++netsnmp_fsys_calculate32(netsnmp_fsys_info *f)
+ {
+     unsigned long long s = f->size;
+-    unsigned long long u = f->units;
+-    int factor = 0;
++    unsigned shift = 0;
++
+     while (s > INT32_MAX) {
+         s = s >> 1;
+-        u = u << 1;
+-        factor++;
++        shift++;
+     }
+ 
+     f->size_32 = s;
+-    f->units_32 = u;
+-    f->avail_32 = f->avail << factor;
+-    f->used_32 = f->used << factor;
++    f->units_32 = f->units << shift;
++    f->avail_32 = f->avail >> shift;
++    f->used_32 = f->used >> shift;
++
++    DEBUGMSGTL(("fsys", "Results of 32-bit conversion: size %llu -> %lu;"
++		" units %llu -> %lu; avail %llu -> %lu; used %llu -> %lu\n",
++		f->size, f->size_32, f->units, f->units_32,
++		f->avail, f->avail_32, f->used, f->used_32));
+ }
diff --git a/net-snmp.spec b/net-snmp.spec
index 3608f3e..3286e40 100644
--- a/net-snmp.spec
+++ b/net-snmp.spec
@@ -11,7 +11,7 @@
 Summary: A collection of SNMP protocol tools and libraries
 Name: net-snmp
 Version: 5.7.1
-Release: 2%{?dist}
+Release: 3%{?dist}
 Epoch: 1
 
 License: BSD
@@ -40,6 +40,7 @@ Patch8: net-snmp-5.6.1-mysql.patch
 Patch9: net-snmp-5.7.1-systemd.patch
 Patch10: net-snmp-5.7-libtool.patch
 Patch11: net-snmp-5.7-mibs-perl-linking.patch
+Patch12: net-snmp-5.7-hrStorage-units.patch
 
 Requires(post): chkconfig
 Requires(preun): chkconfig
@@ -203,6 +204,7 @@ The net-snmp-sysvinit package provides SysV init scripts for Net-SNMP daemons.
 %patch9 -p1 -b .systemd
 %patch10 -p1 -b .libtool
 %patch11 -p1 -b .mibs-perl
+%patch12 -p1 -b .hrStorage-units
 
 %ifarch sparc64 s390 s390x
 # disable failing test - see https://bugzilla.redhat.com/show_bug.cgi?id=680697
@@ -509,6 +511,9 @@ rm -rf ${RPM_BUILD_ROOT}
 %config(noreplace,missingok) %{_sysconfdir}/sysconfig/snmptrapd
 
 %changelog
+* Mon Oct 22 2012 Jan Safranek <jsafrane at redhat.com> - 1:5.7.1-3
+- fixed units in hrStorageTable and hrFSTable (#789441)
+
 * Wed Oct  5 2011 Jan Safranek <jsafrane at redhat.com> - 1:5.7.1-2
 - fixed perl linking (#742678)
 


More information about the scm-commits mailing list