[OpenAFS-devel] 1.3.86 LINUX largefile-support broken
chas williams - CONTRACTOR
chas@cmf.nrl.navy.mil
Mon, 01 Aug 2005 09:41:38 -0400
In message <42EE0716.4000102@rzg.mpg.de>,Hartmut Reuter writes:
>3 gb is under the 32bit line! if you try to write a 5 gb file you will
>see that this doesn't work correctly. It overwrites the begin of the
>file with the part beyond the 4gb-line!
try this patch. it looks like shifting pp->index is an unsigned long.
the shift is probably wrapping. page_offset() casts it to loff_t before
shifting. not sure when page_offset() came into existence.
Index: src/afs/LINUX/osi_vnodeops.c
===================================================================
RCS file: /cvs/openafs/src/afs/LINUX/osi_vnodeops.c,v
retrieving revision 1.112
diff -u -u -r1.112 osi_vnodeops.c
--- src/afs/LINUX/osi_vnodeops.c 26 Jul 2005 17:39:00 -0000 1.112
+++ src/afs/LINUX/osi_vnodeops.c 1 Aug 2005 13:36:33 -0000
@@ -1263,7 +1267,7 @@
cred_t *credp = crref();
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,4,0)
char *address;
- afs_offs_t offset = pp->index << PAGE_CACHE_SHIFT;
+ afs_offs_t offset = page_offset(pp);
#else
ulong address = afs_linux_page_address(pp);
afs_offs_t offset = pageoff(pp);
@@ -1359,7 +1362,7 @@
int f_flags = 0;
buffer = kmap(pp) + offset;
- base = (pp->index << PAGE_CACHE_SHIFT) + offset;
+ base = page_offset(pp) + offset;
credp = crref();
lock_kernel();