[OpenAFS] Re: Problem with openafs-1.3.81 on kernel 2.6.11.7

chas williams - CONTRACTOR chas@cmf.nrl.navy.mil
Sat, 16 Apr 2005 10:16:09 -0400


In message <249C4DFB1DC7313250ADE276@endicott>,Chaskiel M Grundman writes:
>Index: LINUX/osi_file.c
>RCS file: /cvs/openafs/src/afs/LINUX/osi_file.c,v
>retrieving revision 1.23
>diff -u -d -r1.23 osi_file.c
>--- LINUX/osi_file.c    11 Mar 2005 04:35:42 -0000      1.23
>+++ LINUX/osi_file.c    16 Apr 2005 04:12:30 -0000
>@@ -65,6 +65,7 @@
>     filp->f_mapping =3D tip->i_mapping;
> #endif
> #if defined(AFS_LINUX24_ENV)
>+    filp->f_mode =3D FMODE_READ|FMODE_WRITE;
>     filp->f_op =3D fops_get(tip->i_fop);
> #else
>     filp->f_op =3D tip->i_op->default_file_ops;

yep this fixes the problem!  files in the cache are now 'properly' sized.
i wondered about f_mode at one point way back (2.2 -> 2.4) but it didnt
seem to matter.  anyway, i suspect it would be safe to have this outside
the LINUX24 ifdef.  also, the truncate_inode_pages() is already handled
by the vmtruncate() in inode_setattr().

Index: osi_file.c
===================================================================
RCS file: /cvs/openafs/src/afs/LINUX/osi_file.c,v
retrieving revision 1.23
diff -u -u -r1.23 osi_file.c
--- osi_file.c	11 Mar 2005 04:35:42 -0000	1.23
+++ osi_file.c	16 Apr 2005 14:04:34 -0000
@@ -61,6 +61,7 @@
     FILE_INODE(filp) = tip;
     tip->i_flags |= MS_NOATIME;	/* Disable updating access times. */
     filp->f_flags = O_RDWR;
+    filp->f_mode = FMODE_READ|FMODE_WRITE;
 #if defined(AFS_LINUX26_ENV)
     filp->f_mapping = tip->i_mapping;
 #endif
@@ -155,8 +155,6 @@
 	inode_setattr(inode, &newattrs);
 #endif
     unlock_kernel();
-    if (!code)
-	truncate_inode_pages(&inode->i_data, asize);
 #else
     inode->i_size = asize;
     if (inode->i_sb->s_op && inode->i_sb->s_op->notify_change) {