Bug 189238 - Wrong fragment size when using statfs on NFS
Wrong fragment size when using statfs on NFS
Status: CLOSED ERRATA
Product: Red Hat Enterprise Linux 4
Classification: Red Hat
Component: kernel (Show other bugs)
4.0
All Linux
medium Severity medium
: ---
: ---
Assigned To: Steve Dickson
Brian Brock
:
: 182596 (view as bug list)
Depends On:
Blocks: 176344
  Show dependency treegraph
 
Reported: 2006-04-18 11:17 EDT by Bastien Nocera
Modified: 2007-11-30 17:07 EST (History)
4 users (show)

See Also:
Fixed In Version: RHBA-2007-0304
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2007-05-07 21:08:04 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)
reproducer program (430 bytes, text/plain)
2006-07-18 13:29 EDT, Amit Gud
no flags Details
fix 1 (386 bytes, patch)
2006-07-22 16:59 EDT, Amit Gud
no flags Details | Diff

  None (edit)
Description Bastien Nocera 2006-04-18 11:17:56 EDT
1. Mount an NFS mount with non-default rsize and wsize:

amd64:/tmp on /mnt/iso type nfs
(rw,nfsvers=3,rsize=8192,wsize=8192,hard,nointr,addr=172.16.10.230)

2. Launch a simple test program which calls statvfs/statfs:
#include <sys/statvfs.h>
int main (int argc, char **argv)
{
        struct statvfs statfs_buffer;
        statvfs ("/mnt/iso/", &statfs_buffer);
        return 0;
}

3. Check the strace of that program
statfs64("/mnt/iso/", 84, {f_type="NFS_SUPER_MAGIC", f_bsize=8192,
f_blocks=1764078, f_bfree=1252601, f_bavail=1162989, f_files=1795200,
f_ffree=1584215, f_fsid={0, 0}, f_namelen=255, f_frsize=4096}) = 0

The f_frsize member says "4096" instead of "8192".
gnome-vfs and df (when using statvfs) and this code to calculate the amount of
space left on a filesystem:
free = statfs_buffer.f_frsize * statfs_buffer.f_bavail

On a stock RHEL4 system, df is actually using statfs so doesn't show this problem:
free = fsd.f_bsize * fsd.f_bavail
Comment 4 Bastien Nocera 2006-07-18 09:15:22 EDT
*** Bug 182596 has been marked as a duplicate of this bug. ***
Comment 5 Amit Gud 2006-07-18 13:29:56 EDT
Created attachment 132610 [details]
reproducer program

With the attached program, no occurance of bug found on 2.6.17-1.2356.fc6 and
2.6.15-1.2054_FC5. statvfs reports correct f_frsize with mount options
rw,nfsvers=3,rsize=8192,wsize=8192,hard,nointr

Would be good to know the kernel version or the rhel version on which the bug
was observed.
Comment 6 Bastien Nocera 2006-07-19 03:35:48 EDT
The RHEL version is the one mentioned in the "Version" field.
The test kernel was the latest stable RHEL4 kernel: 2.6.9-34.EL
Comment 7 Amit Gud 2006-07-22 16:59:56 EDT
Created attachment 132872 [details]
fix 1

I was able to successfully reproduce the bug on 2.6.9-42.EL and it does go away
with the attached fix. Upstream kernel and even devel branch of rhel kernel
takes frsize as blocksize in superblock. I'm trying to find out exactly which
patch changes this particular code. However, attached fix should serve the
purpose.
Comment 8 mike eisler 2006-08-07 23:50:58 EDT
My understanding is the  NFS client file system 
should be able to use what ever
it wants for f_frsize. As long as 
      
      tbytes = f_frsize * f_blocks

      fbytes = f_frsize * f_bfree 
         
      abytes = f_frsize * f_bavail

That said, it is pointless, for NFS, if not all other
file systems, to have f_frsize be different than f_bsize.
It just causes confusion.
Comment 9 RHEL Product and Program Management 2006-09-07 15:21:43 EDT
This request was evaluated by Red Hat Product Management for inclusion in a Red
Hat Enterprise Linux maintenance release.  Product Management has requested
further review of this request by Red Hat Engineering, for potential
inclusion in a Red Hat Enterprise Linux Update release for currently deployed
products.  This request is not yet committed for inclusion in an Update
release.
Comment 10 RHEL Product and Program Management 2006-09-07 15:21:50 EDT
This request was evaluated by Red Hat Product Management for inclusion in a Red
Hat Enterprise Linux maintenance release.  Product Management has requested
further review of this request by Red Hat Engineering, for potential
inclusion in a Red Hat Enterprise Linux Update release for currently deployed
products.  This request is not yet committed for inclusion in an Update
release.
Comment 11 RHEL Product and Program Management 2006-09-07 15:22:21 EDT
This request was evaluated by Red Hat Product Management for inclusion in a Red
Hat Enterprise Linux maintenance release.  Product Management has requested
further review of this request by Red Hat Engineering, for potential
inclusion in a Red Hat Enterprise Linux Update release for currently deployed
products.  This request is not yet committed for inclusion in an Update
release.
Comment 15 Jason Baron 2006-09-21 20:36:46 EDT
committed in stream U5 build 42.13. A test kernel with this patch is available
from http://people.redhat.com/~jbaron/rhel4/
Comment 18 Red Hat Bugzilla 2007-05-07 21:08:05 EDT
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 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-2007-0304.html

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