From: Olaf Kirch The attached patch fixes a problem with the 32bit statfs call on NFS file systems. Some NFS servers return a value of -1 for the f_files and f_ffree. The current code would think this is a 64bit value that cannot be converted to 32bits. Consequently, the system call would always fail. The patch adds two special if() to detect a value of -1 for f_files and f_ffree. --- /dev/null | 0 25-akpm/fs/open.c | 13 +++++++++++-- 2 files changed, 11 insertions(+), 2 deletions(-) diff -puN fs/open.c~nfs-32bit-statfs-fix fs/open.c --- 25/fs/open.c~nfs-32bit-statfs-fix Mon Apr 5 15:01:23 2004 +++ 25-akpm/fs/open.c Mon Apr 5 15:02:48 2004 @@ -57,10 +57,19 @@ static int vfs_statfs_native(struct supe memcpy(buf, &st, sizeof(st)); else { if (sizeof buf->f_blocks == 4) { - if ((st.f_blocks | st.f_bfree | - st.f_bavail | st.f_files | st.f_ffree) & + if ((st.f_blocks | st.f_bfree | st.f_bavail) & 0xffffffff00000000ULL) return -EOVERFLOW; + /* + * f_files and f_ffree may be -1; it's okay to stuff + * that into 32 bits + */ + if (st.f_files != 0xffffffffffffffffULL && + (st.f_files & 0xffffffff00000000ULL)) + return -EOVERFLOW; + if (st.f_ffree != 0xffffffffffffffffULL && + (st.f_ffree & 0xffffffff00000000ULL)) + return -EOVERFLOW; } buf->f_type = st.f_type; diff -L fs/open.c.overflow -puN /dev/null /dev/null _