Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/lib/libperfuse Remove PUFFS_KFLAG_WTCACHE, which caused data...



details:   https://anonhg.NetBSD.org/src/rev/89f581998b59
branches:  trunk
changeset: 768113:89f581998b59
user:      manu <manu%NetBSD.org@localhost>
date:      Tue Aug 09 06:58:33 2011 +0000

description:
Remove PUFFS_KFLAG_WTCACHE, which caused data corruption and slowdown

diffstat:

 lib/libperfuse/perfuse.c |  22 ++++++++++++++++++++--
 1 files changed, 20 insertions(+), 2 deletions(-)

diffs (36 lines):

diff -r bafbe8edb549 -r 89f581998b59 lib/libperfuse/perfuse.c
--- a/lib/libperfuse/perfuse.c  Tue Aug 09 06:36:51 2011 +0000
+++ b/lib/libperfuse/perfuse.c  Tue Aug 09 06:58:33 2011 +0000
@@ -1,4 +1,4 @@
-/*  $NetBSD: perfuse.c,v 1.16 2011/06/28 16:19:16 manu Exp $ */
+/*  $NetBSD: perfuse.c,v 1.17 2011/08/09 06:58:33 manu Exp $ */
 
 /*-
  *  Copyright (c) 2010-2011 Emmanuel Dreyfus. All rights reserved.
@@ -484,7 +484,25 @@
        PUFFSOP_SET(pops, perfuse, node, deleteextattr);
 #endif /* PUFFS_EXTNAMELEN */
 
-       puffs_flags = PUFFS_KFLAG_WTCACHE;
+       /*
+        * We used to have PUFFS_KFLAG_WTCACHE here, which uses the
+        * page cache (highly desirable to get mmap(2)), but still sends
+        * all writes to the filesystem. In fact it does not send the
+        * data written, but the pages that contain it. 
+        *
+        * There is a nasty bug hidden somewhere, possibly in libpuffs'
+        * VOP_FSYNC, which sends an asynchronous PUFFS_SETATTR that
+        * update file size. When writes are in progress, it will cause
+        * the file to be truncated and we get a zero-filled chunk at the
+        * beginning of a page. Removing PUFFS_KFLAG_WTCACHE fixes that
+        * problem. 
+        * 
+        * The other consequences are that changes will not be propagated
+        * immediatly to the filesystem, and we get a huge performance gain
+        * because much less requests are sent. A test case for the above
+        * mentioned bug got its execution time slashed by factor 50.
+        */
+       puffs_flags = 0;
 
        if (perfuse_diagflags & PDF_PUFFS)
                puffs_flags |= PUFFS_FLAG_OPDUMP;



Home | Main Index | Thread Index | Old Index