Bug 474161

Summary: net-snmp does not use statfs64 on Red Hat Enterprise Linux 4
Product: Red Hat Enterprise Linux 4 Reporter: Olivier Fourdan <ofourdan>
Component: net-snmpAssignee: Jan Safranek <jsafrane>
Status: CLOSED ERRATA QA Contact: BaseOS QE <qe-baseos-auto>
Severity: medium Docs Contact:
Priority: medium    
Version: 4.7CC: kem, mmarcini, rvokal, tao
Target Milestone: rc   
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
* UCD-SNMP-MIB::dskPercent was based on statfs, which would fail when used on devices larger than 32 terabytes. Net-snmp is now built with support for 64-bit file offsets, and can therefore use statfs64 to calculate disk usage correctly for large devices.
Story Points: ---
Clone Of: Environment:
Last Closed: 2009-05-18 20:19:09 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Attachments:
Description Flags
Patch for the spec to add -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 none

Description Olivier Fourdan 2008-12-02 15:31:30 UTC
Created attachment 325382 [details]
Patch for the spec to add -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64

Description of problem:

The build of net-snmp provided on Red Hat Enterprise Linux 4 does not use the stat*64 variant.

That causes an error with disks larger than 32Tb.

Version-Release number of selected component (if applicable):

net-snmp-libs-5.1.2-13.2

How reproducible:

100% reproducible

Steps to Reproduce:
1. strace -p $(cat /var/run/snmpd.pid) 2>&1 | grep stat
2. snmpwalk -v 2c localhost -c public UCD-SNMP-MIB::dskPercent

  
Actual results:

statfs("/", {f_type="EXT2_SUPER_MAGIC", ...}) = 0

Expected results:

statfs64("/", 84, {f_type="EXT2_SUPER_MAGIC", ...}) = 0

Additional info:

With disks larger than 32Tb, the statfs() call fails in var_extensible_disk() of agent/mibgroup/ucd-snmp/disk.c

The problem does not happen on Red Hat Enterprise Linux 5 because net-snmp is built with “-D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64” while this is not the case on Red Hat Enterprise Linux 4.

One can simulate a disk > 32Tb using device mapper with dm-zero and dm-snapshot but I don't think we ship any filesystem that can handle more than 16Tb on EL4, so the best is to use a kernel that includes jfs to install on top of the 32Tb disk.

Otherwise, use strace as shown above.

Comment 1 Jan Safranek 2008-12-10 08:39:14 UTC
I'd fix it in next update. Please note the requested change fixes only dskPercent OID (that's what the IT is about), the other items in dskTable (like dskAvail, dskTotal, ...) will report only 31 bits (Integer32 incl. one bit for sign) and are useless for disks >~2TB.

Comment 4 Ruediger Landmann 2009-01-22 06:26:20 UTC
Release note added. If any revisions are required, please set the 
"requires_release_notes" flag to "?" and edit the "Release Notes" field accordingly.
All revisions will be proofread by the Engineering Content Services team.

New Contents:
* UCD-SNMP-MIB::dskPercent was based on statfs, which would fail when used on devices larger than 32 terabytes. Net-snmp is now built with support for 64-bit file offsets, and can therefore use statfs64 to calculate disk usage correctly for large devices.

Comment 6 errata-xmlrpc 2009-05-18 20:19:09 UTC
An advisory has been issued which should help the problem
described in this bug report. This report is therefore being
closed with a resolution of ERRATA. For more information
on therefore solution and/or where to find the updated files,
please follow the link below. You may reopen this bug report
if the solution does not work for you.

http://rhn.redhat.com/errata/RHBA-2009-0984.html