[OpenAFS-devel] Bug with OpenAFS memory-mapped file I/O under Linux [grand.central.org #807]

Nickolai Zeldovich kolya@MIT.EDU
Mon, 21 Jan 2002 18:29:03 -0500


>                          After looking a bit at the Linux afs and vm
> code, perhaps we should call filemap_fdatasync() somewhere to get the
> data from pages into dcache's?

Some more experimentation suggests that write_inode_now() could be
the right way to go about it, and the following patch indeed seems
to fix mmap writes on Linux 2.4.

-- kolya

--- src/afs/LINUX/osi_vm.c	2001/10/08 22:15:27	1.9
+++ src/afs/LINUX/osi_vm.c	2002/01/21 23:12:01
@@ -89,7 +89,15 @@
  */
 void osi_VM_StoreAllSegments(struct vcache *avc)
 {
+#ifdef AFS_LINUX24_ENV
+    struct inode *ip = (struct inode *) avc;
 
+    ReleaseWriteLock(&avc->lock);
+    AFS_GUNLOCK();
+    write_inode_now(ip, 1);
+    AFS_GLOCK();
+    ObtainWriteLock(&avc->lock, 121);
+#endif
 }
 
 /* Purge VM for a file when its callback is revoked.