[OpenAFS-devel] 1.3.86 LINUX largefile-support broken

Rainer Toebbicke rtb@pclella.cern.ch
Tue, 02 Aug 2005 13:18:48 +0200


chas williams - CONTRACTOR wrote:
> 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();

On my 2.6.9-11.ELsmp x86_64 test machine this just leads to "kernel: 
libafs: Unknown symbol page_offset" when loading.

page_offset is defined in linux/nfs_fs.h (and yes the BIG difference 
seems to be the loff_t cast) which should probably be included - but 
does it exist for all kernels?

--- openafs/src/afs/LINUX/osi_vnodeops.c.old   2005-08-02 
10:42:25.000000000 +0200
+++ openafs/src/afs/LINUX/osi_vnodeops.c    2005-08-02 
13:00:50.000000000 +0200
@@ -34,6 +34,7 @@
  #include "h/pagemap.h"
  #if defined(AFS_LINUX24_ENV)
  #include "h/smp_lock.h"
+#include "linux/nfs_fs.h"
  #endif
  #if defined(AFS_LINUX26_ENV)
  #include "h/writeback.h"

(no time to test the 3G, 5G cases yet, though...)

-- 
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
Rainer Toebbicke
European Laboratory for Particle Physics(CERN) - Geneva, Switzerland
Phone: +41 22 767 8985       Fax: +41 22 767 7155