Bug 189238

Summary: Wrong fragment size when using statfs on NFS
Product: Red Hat Enterprise Linux 4 Reporter: Bastien Nocera <bnocera>
Component: kernelAssignee: Steve Dickson <steved>
Status: CLOSED ERRATA QA Contact: Brian Brock <bbrock>
Severity: medium Docs Contact:
Priority: medium    
Version: 4.0CC: clasohm, jbaron, k.georgiou, steved
Target Milestone: ---   
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: RHBA-2007-0304 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2007-05-08 01:08:04 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:
Bug Depends On:    
Bug Blocks: 176344    
Attachments:
Description Flags
reproducer program
none
fix 1 none

Description Bastien Nocera 2006-04-18 15:17:56 UTC
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 13:15:22 UTC
*** Bug 182596 has been marked as a duplicate of this bug. ***

Comment 5 Amit Gud 2006-07-18 17:29:56 UTC
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 07:35:48 UTC
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 20:59:56 UTC
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-08 03:50:58 UTC
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 Program Management 2006-09-07 19:21:43 UTC
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 Program Management 2006-09-07 19:21:50 UTC
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 Program Management 2006-09-07 19:22:21 UTC
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-22 00:36:46 UTC
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-08 01:08:05 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 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