Bug 146427 - statvfs() returns bad values when nfs filesystem supports more than 0x7fffffff files
Summary: statvfs() returns bad values when nfs filesystem supports more than 0x7ffffff...
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 3
Classification: Red Hat
Component: kernel
Version: 3.0
Hardware: i686
OS: Linux
medium
medium
Target Milestone: ---
Assignee: Steve Dickson
QA Contact: Brian Brock
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2005-01-28 02:13 UTC by paul popelka
Modified: 2007-11-30 22:07 UTC (History)
2 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2005-02-07 21:50:28 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)

Description paul popelka 2005-01-28 02:13:50 UTC
Description of problem:
Mount an nfs filesystem that supports more than 0xffffffff files onto 
the linux client.  Do a df or run my simple test program (supplied).  
Here's what df says:

tsfs:/6Gb                    1         1         1   0% /mnt/6

Here's what the simple test program displays:

[root@labserv1 root]# ./a.out /mnt/6
statvfs info for /mnt/6:
f_bsize            -1
f_frsize           -1
f_blocks           -1
f_bfree            -1
f_bavail           -1
f_files            -1
f_ffree            -1
f_favail           -1
f_fsid              0
f_flag     0x0
f_namemax         255
[root@labserv1 root]#

Here's the test program:

#include <stdio.h>
#include <string.h>
#include <errno.h>
#include <sys/types.h>
#include <sys/statvfs.h>

extern int errno;

char *progname;

int
main( int argc, char *argv[] ) {
        int i;
        int rc;
        struct statvfs statvfsbuf;

        progname = argv[0];

        for ( i = 1; i < argc; i++ ) {
                rc = statvfs( argv[i], &statvfsbuf );
                if ( rc != 0 ) {
                        fprintf( stderr, "%s: statvfs on %s failed, 
error %s\n",
                                progname,
                                argv[i],
                                strerror( errno ) );
                } else {
                        fprintf( stdout, "statvfs info for %s:\n",
                                argv[i] );
                        fprintf( stdout, "f_bsize    %10d\n",
                                statvfsbuf.f_bsize );
                        fprintf( stdout, "f_frsize   %10d\n",
                                statvfsbuf.f_frsize );
                        fprintf( stdout, "f_blocks   %10d\n",
                                statvfsbuf.f_blocks );
                        fprintf( stdout, "f_bfree    %10d\n",
                                statvfsbuf.f_bfree );
                        fprintf( stdout, "f_bavail   %10d\n",
                                statvfsbuf.f_bavail );
                        fprintf( stdout, "f_files    %10d\n",
                                statvfsbuf.f_files );
                        fprintf( stdout, "f_ffree    %10d\n",
                                statvfsbuf.f_ffree );
                        fprintf( stdout, "f_favail   %10d\n",
                                statvfsbuf.f_favail );
                        fprintf( stdout, "f_fsid     %10d\n",
                                statvfsbuf.f_fsid );
/*
                        fprintf( stdout, "f_basetype %s\n",
                                statvfsbuf.f_basetype );
*/
                        fprintf( stdout, "f_flag     0x%x\n",
                                statvfsbuf.f_flag );
                        fprintf( stdout, "f_namemax  %10d\n",
                                statvfsbuf.f_namemax );
/*
                        fprintf( stdout, "f_fstr     %s\n",
                                statvfsbuf.f_fstr );
*/
                }
        }

        return 0;
}

Here's some ethereal output of the fsstat nfs request:

Remote Procedure Call, Type:Reply XID:0xa822985f
    XID: 0xa822985f (2820839519)
    Message Type: Reply (1)
    Program: NFS (100003)
    Program Version: 3
    Procedure: FSSTAT (18)
    Reply State: accepted (0)
    This is a reply to a request in frame 21
    Time from request: 0.000500000 seconds
    Verifier
        Flavor: AUTH_NULL (0)
        Length: 0
    Accept State: RPC executed successfully (0)
Network File System, FSSTAT Reply
    Program Version: 3
    V3 Procedure: FSSTAT (18)
    Status: OK (0)
    obj_attributes
        attributes_follow: value follows (1)
        attributes
            Type: Directory (2)
            mode: 0555
                0... .... .... = not SUID
                .0.. .... .... = not SGID
                ..0. .... .... = not save swapped text
                ...1 .... .... = Read permission for owner
                .... 0... .... = no Write permission for owner
                .... .1.. .... = Execute permission for owner
                .... ..1. .... = Read permission for group
                .... ...0 .... = no Write permission for group
                .... .... 1... = Execute permission for group
                .... .... .1.. = Read permission for others
                .... .... ..0. = no Write permission for others
                .... .... ...1 = Execute permission for others
            nlink: 3
            uid: 0
            gid: 0
            size: 136
            used: 4096
            rdev: 0,0
                specdata1: 0
                specdata2: 0
            fsid: 1106862748
            fileid: 2
            atime: Jan 27, 2005 13:52:30.669895339
                seconds: 1106862750
                nano seconds: 669895339
            mtime: Jan 27, 2005 13:52:30.669895339
                seconds: 1106862750
                nano seconds: 669895339
            ctime: Jan 27, 2005 13:52:30.669895339
                seconds: 1106862750
                nano seconds: 669895339
    Total bytes: 10686382080
    Free bytes: 10686320640
    Available free bytes: 10686320640
    Total file slots: 9223372036854775807   <<<<<<***********
    Free file slots: 9223372036854775807    <<<<<<***********
    Available free file slots: 9223372036854775807  <<<<<<***********
    invarsec: 1

0000  00 c0 9f 44 c2 39 00 04 80 68 52 00 08 00 45 
00   ...D.9...hR...E.
0010  00 c4 06 b8 00 00 3d 11 e0 b6 ac 14 81 8a ac 
14   ......=.........
0020  bc 07 08 01 03 1f 00 b0 ca 26 a8 22 98 5f 00 
00   .........&."._..
0030  00 01 00 00 00 00 00 00 00 00 00 00 00 00 00 
00   ................
0040  00 00 00 00 00 00 00 00 00 01 00 00 00 02 00 
00   ................
0050  01 6d 00 00 00 03 00 00 00 00 00 00 00 00 00 
00   .m..............
0060  00 00 00 00 00 88 00 00 00 00 00 00 10 00 00 
00   ................
0070  00 00 00 00 00 00 00 00 00 00 41 f9 62 9c 00 
00   ..........A.b...
0080  00 00 00 00 00 02 41 f9 62 9e 27 ed ca ab 41 
f9   ......A.b.'...A.
0090  62 9e 27 ed ca ab 41 f9 62 9e 27 ed ca ab 00 00   
b.'...A.b.'.....
00a0  00 02 7c f5 40 00 00 00 00 02 7c f4 50 00 00 
00   ..|.@.....|.P...
00b0  00 02 7c f4 50 00 7f ff ff ff ff ff ff ff 7f 
ff   ..|.P...........
00c0  ff ff ff ff ff ff 7f ff ff ff ff ff ff ff 00 
00   ................
00d0  00 01

The nfs server implementation is under my control so, I was able to 
adjust the file counts until df started working.  I found that values 
less than or equal to 0x7fffffff allow df to report sensible values.


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


How reproducible:
Happens all the time with my test system and a customers redhat AS 3 
system.


Steps to Reproduce:
1. Mount nfs filesystem that supports > 0x7fffffff files
2. Do a df on the linux client.
3.
  
Actual results:
tsfs:/6Gb                    1         1         1   0% /mnt/6

Expected results:
I expect the size displayed to be around 6 gigabytes.

Additional info:
We've been reproducing this problem with a 32 bit rh linux client 
kernel running on 32 bit hardware. Our inhouse tests use a Dell 750 
test client.  I've been told that a 64 bit rh linux client kernel 
doesn't exhibit this problem.

Here's some uname -a (for our test client) output:

Linux labserv1 2.4.21-20.ELsmp #1 SMP Wed Aug 18 20:46:40 EDT 2004 
i686 i686 i386 GNU/Linux

Comment 1 paul popelka 2005-01-28 18:23:18 UTC
I forgot to add that this problem only appears if using nfs v3.

Comment 2 Ernie Petrides 2005-02-01 01:06:25 UTC
Paul, we implemented 64-bit statfs support over NFS in RHEL3 U4.  Could
you please try an up-to-date kernel and let us know whether this problem
is resolved?

The latest release kernel is in advisory RHSA-2005:043, which you can get
at through the link below:

  http://porkchop.redhat.com/errata/erratainfo.cgi?advisory=2005%3A043

Thanks.  -ernie


Comment 3 paul popelka 2005-02-03 19:15:35 UTC
We have verified that runing df on a client running RHEL3 U4 displays sensible 
values.  I guess you can close this bug.

Thankyou for your help.
Paul

Comment 4 Ernie Petrides 2005-02-07 21:50:28 UTC
An errata 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 the 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-2004-550.html



Note You need to log in before you can comment on or make changes to this bug.