Bug 2546 - statvfs() implementation in glibc-2.1 is broken
statvfs() implementation in glibc-2.1 is broken
Status: CLOSED CURRENTRELEASE
Product: Red Hat Linux
Classification: Retired
Component: glibc (Show other bugs)
6.0
All Linux
high Severity medium
: ---
: ---
Assigned To: Cristian Gafton
:
: 2519 3214 3304 (view as bug list)
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 1999-05-04 14:04 EDT by Elías Halldór Ágústsson
Modified: 2008-05-01 11:37 EDT (History)
8 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 1999-07-02 16:21:35 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)

  None (edit)
Description Elías Halldór Ágústsson 1999-05-04 14:04:43 EDT
A recently implemented statvfs()in glibc-2.1 is
commonly defined instead of statfs(). However, this
seems to be broken. Programs built with <sys/statvfs.h>
instead of <sys/vfs.h> or <sys/statfs.h> will always
report 0 bytes free for any partition.

------- Additional Comments From   05/06/99 16:09 -------
I can verify this too. Seems f_frsize is always 0 and some programs
including inndf use f_frsize to calculate size of filesystem.
#include <stdio.h>
#include <sys/statvfs.h>

int main(void) {
    struct statvfs buf;

    if (statvfs("/", &buf) != 0) exit(1);

printf("f_bsize=%ld\nf_frsize=%ld\nf_blocks=%ld\nf_bfree=%ld\nf_bavail=%ld\nf_files=%ld\nf_ffree=%ld\nf_favail=%ld\nf_fsid=%ld\nf_flag=%ld\nf_namemax=%ld\n",
	   buf.f_bsize,
	   buf.f_frsize,
	   buf.f_blocks,
	   buf.f_bfree,
	   buf.f_bavail,
	   buf.f_files,
	   buf.f_ffree,
	   buf.f_favail,
	   buf.f_fsid,
	   buf.f_flag,
	   buf.f_namemax);
    exit(0);
}
Comment 1 Elías Halldór Ágústsson 1999-05-07 07:49:59 EDT
The problem seems to be resulting from the glibc-2.11-fstatvfs.patch
Is this patch really necessary at all?

The offending parts of the patch (originally submitted from
hjl@gnu.org to gafton@redhat.com):

diff -u -p -r1.1.1.4 fstatvfs.c
--- sysdeps/unix/sysv/linux/fstatvfs.c  1998/10/23 21:15:21
1.1.1.4
+++ sysdeps/unix/sysv/linux/fstatvfs.c  1999/04/09 22:08:15
@@ -80,8 +76,9 @@ fstatvfs (int fd, struct statvfs *buf)
     case UFS_MAGIC:
     case UFS_CIGAM:
     default:
-      /* I hope it's safe to assume no fragmentation.  */
-      buf->f_frsize = buf->f_bsize;
+      /* Since Linux doesn't support f_frsize, we set it to 0. "df"
+        will be happy with it. */
+      buf->f_frsize = 0;
       break;
     }


(should it really by enough that only "df" is happy about it?)
Comment 2 Jeff Johnson 1999-05-16 19:52:59 EDT
*** Bug 2519 has been marked as a duplicate of this bug. ***

innwatch will always throttle the server, because it
gets disk usage statistics from inndf, which will always
report 0 bytes available because it was compiled with
#define HAVE_STATVFS instead of #define HAVE_STATFS
and #define HAVE_SYS_VFS_H

Obviously, the new statvfs implementation does seem to
be still somewhat lacking.
Comment 3 Jeff Johnson 1999-06-02 12:51:59 EDT
*** Bug 3214 has been marked as a duplicate of this bug. ***

On a sparc64 ext2fs file system, statvfs is returning
a struct statvfs with the element f_frsize == 0. Judging
from the implementation in backends/inndf.c (inn-2.2),
this value possibly should be the same as f_bsize (== 1024)
rather than 0.
Comment 4 Jeff Johnson 1999-06-06 21:15:59 EDT
*** Bug 3304 has been marked as a duplicate of this bug. ***

PHP's diskfreespace() function fails due to an error in
RH6's glibc, see
http://www.progressive-comp.com/Lists/?l=php3-general&m=92870575015735&w=2

I have also seen problems with Samba - related to Red Hat
6's glibc version (which is a pre-release of glibc).

I think that an updated set of glibc RPMs (with the
_released_ glibc 2.1 - not the pre-release) is an urgent
need. Any time frame for that?
Comment 5 Lance A. Brown 1999-06-30 18:01:59 EDT
Is a updated RPM fixing this problem imminent?  This bug is causing
severe problems on my RH 6.0 servers, including a news server running
INN.
Comment 6 Cristian Gafton 1999-07-02 16:21:59 EDT
Patch removed from the RPM, glibc upgraded to the stable 2.1.2.
Package should be available in rawhide shortly.

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