* [PATCH] Fix 32bit statfs on NFS
@ 2004-04-05 15:09 Olaf Kirch
0 siblings, 0 replies; only message in thread
From: Olaf Kirch @ 2004-04-05 15:09 UTC (permalink / raw)
To: akpm; +Cc: nfs
[-- Attachment #1: Type: text/plain, Size: 470 bytes --]
Hi Andrew,
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.
Olaf
--
Olaf Kirch | The Hardware Gods hate me.
okir@suse.de |
---------------+
[-- Attachment #2: statfs-no-eoverflow --]
[-- Type: text/plain, Size: 771 bytes --]
--- linux-2.6.4/fs/open.c.overflow 2004-04-01 22:22:25.000000000 +0200
+++ linux-2.6.4/fs/open.c 2004-04-01 22:27:13.000000000 +0200
@@ -57,10 +57,17 @@
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;
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2004-04-05 15:10 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-04-05 15:09 [PATCH] Fix 32bit statfs on NFS Olaf Kirch
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox