Don't return AOP_WRITEPAGE_ACTIVATE to write()
authorSimon Wilkinson <sxw@inf.ed.ac.uk>
Fri, 23 Oct 2009 15:34:33 +0000 (16:34 +0100)
committerDerrick Brashear <shadow|account-1000005@unknown>
Sun, 25 Oct 2009 00:19:38 +0000 (17:19 -0700)
When we're called from write(), we don't have the option
of deferring the writing of a page by returning AOP_WRITEPAGE_ACTIVATE.
Instead, write() simply sees this as the output of 0x8000 bytes of data.

So, whilst we can mark a vcache as being output, we can't defer the
processing of one which is already being written (by, for example, an
earlier writepage()).

This problem only affects files which are have mmap() and write()
called in quick succession, but it does break the fsx utility.

Change-Id: I750a186de38da9873665a862f5b584a78e6979ad
Reviewed-on: http://gerrit.openafs.org/725
Reviewed-by: Marc Dionne <marc.c.dionne@gmail.com>
Tested-by: Marc Dionne <marc.c.dionne@gmail.com>
Tested-by: Derrick Brashear <shadow@dementia.org>
Reviewed-by: Derrick Brashear <shadow@dementia.org>

src/afs/LINUX/osi_vnodeops.c

index c851adf..a9739db 100644 (file)
@@ -2070,15 +2070,13 @@ afs_linux_writepage_sync(struct inode *ip, struct page *pp,
 
     /* Catch recursive writeback. This occurs if the kernel decides
      * writeback is required whilst we are writing to the cache, or
-     * flushing to the server. */
+     * flushing to the server. When we're running syncronously (as
+     * opposed to from writepage) we can't actually do anything about
+     * this case - as we can't return AOP_WRITEPAGE_ACTIVATE to write()
+     */
     AFS_GLOCK();
     ObtainWriteLock(&vcp->lock, 532);
-    code = afs_linux_prepare_writeback(vcp);
-    if (code) {
-       ReleaseWriteLock(&vcp->lock);
-       AFS_GUNLOCK();
-       return code;
-    }
+    afs_linux_prepare_writeback(vcp);
     ReleaseWriteLock(&vcp->lock);
     AFS_GUNLOCK();