ktpence / macfuse

Automatically exported from code.google.com/p/macfuse
Other
0 stars 0 forks source link

attributes cache is not invalidated on a write with direct_io #218

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. Mount a FUSE filesystem such as fusexmp with the -o direct_io option
2. Run "iozone -a" and it will fail

Iozone does a bunch of writes and then does lseeks from the end of the file.  
These fail because 
the cached attribute size is still 0.

The following patch seems to fix the problem.

--- ../macfuse_0.3.0/fusefs/fuse_vnops.c        2007-06-12 05:55:21.000000000 
-0400
+++ ../macfuse_0.3.0/fusefs/fuse_vnops.c.orig   2007-06-01 09:29:41.000000000 
-0400
@@ -3301,8 +3301,6 @@
             uio_setoffset(uio, (uio_offset(uio) - diff));
         } /* while */

-        fuse_invalidate_attr(vp);
-
         fuse_ticket_drop(fdi.tick);

         return error;

Original issue reported on code.google.com by jchan...@gmail.com on 12 Jun 2007 at 10:34

GoogleCodeExporter commented 8 years ago
I'll look into this.

Original comment by si...@gmail.com on 12 Jun 2007 at 2:18

GoogleCodeExporter commented 8 years ago
Well, direct_io is ugly by nature and in many ways, it _does_ mean that one is 
ignoring the file size. In your 
example case, you want the file size to be "correct", so there's a conflict, 
really. Even though invalidating the 
cached attributes will make it "work" in your example case, you still 
can't/shouldn't depend on the size always if 
you use direct_io.

Anyway, I'll probably add a "fix" in the next release so your example case 
works.

Original comment by si...@gmail.com on 26 Jun 2007 at 8:23