[OpenAFS-devel] Building cvs head on Linux 2.6

chas williams (contractor) chas@cmf.nrl.navy.mil
Sat, 29 May 2004 12:37:48 -0400


In message <20040529151844.GA25317@locomotive.unixthugs.org>,Jeff Mahoney writes:
>There was some recent debugging of a pretty severe race condition that caus=
>ed
>page->count to be renamed to _count in order to track down direct accesses.

i see.  ian, please try the following:


Index: osi_vnodeops.c
===================================================================
RCS file: /cvs/openafs/src/afs/LINUX/osi_vnodeops.c,v
retrieving revision 1.74
diff -u -u -r1.74 osi_vnodeops.c
--- osi_vnodeops.c	21 Apr 2004 02:20:23 -0000	1.74
+++ osi_vnodeops.c	29 May 2004 16:36:12 -0000
@@ -1380,7 +1380,7 @@
     uio_t tuio;
     struct iovec iovec;
     struct inode *ip = FILE_INODE(fp);
-    int cnt = atomic_read(&pp->count);
+    int cnt = page_count(pp);
     struct vcache *avc = ITOAFS(ip);
 
     AFS_GLOCK();
@@ -1525,7 +1525,7 @@
 
     credp = crref();
     afs_Trace4(afs_iclSetp, CM_TRACE_UPDATEPAGE, ICL_TYPE_POINTER, vcp,
-	       ICL_TYPE_POINTER, pp, ICL_TYPE_INT32, atomic_read(&pp->count),
+	       ICL_TYPE_POINTER, pp, ICL_TYPE_INT32, page_count(pp),
 	       ICL_TYPE_INT32, 99999);
 
     setup_uio(&tuio, &iovec, buffer, base, count, UIO_WRITE, AFS_UIOSYS);
@@ -1547,7 +1547,7 @@
     code = code ? -code : count - tuio.uio_resid;
 
     afs_Trace4(afs_iclSetp, CM_TRACE_UPDATEPAGE, ICL_TYPE_POINTER, vcp,
-	       ICL_TYPE_POINTER, pp, ICL_TYPE_INT32, atomic_read(&pp->count),
+	       ICL_TYPE_POINTER, pp, ICL_TYPE_INT32, page_count(pp),
 	       ICL_TYPE_INT32, code);
 
     crfree(credp);
@@ -1586,7 +1586,7 @@
     credp = crref();
     AFS_GLOCK();
     afs_Trace4(afs_iclSetp, CM_TRACE_UPDATEPAGE, ICL_TYPE_POINTER, vcp,
-	       ICL_TYPE_POINTER, pp, ICL_TYPE_INT32, atomic_read(&pp->count),
+	       ICL_TYPE_POINTER, pp, ICL_TYPE_INT32, page_count(pp),
 	       ICL_TYPE_INT32, 99999);
     setup_uio(&tuio, &iovec, page_addr + offset,
 	      (afs_offs_t) (pageoff(pp) + offset), count, UIO_WRITE,
@@ -1598,7 +1598,7 @@
 
     code = code ? -code : count - tuio.uio_resid;
     afs_Trace4(afs_iclSetp, CM_TRACE_UPDATEPAGE, ICL_TYPE_POINTER, vcp,
-	       ICL_TYPE_POINTER, pp, ICL_TYPE_INT32, atomic_read(&pp->count),
+	       ICL_TYPE_POINTER, pp, ICL_TYPE_INT32, page_count(pp),
 	       ICL_TYPE_INT32, code);
 
     AFS_GUNLOCK();