guomingyang <guomingyang@xxxxxxxxxxxx> wrote: > I'm trying to use nfs with fscache feather in Linux kernel and find a > problem. If a file is opened in a flag other than read-only once, the file > can't be cached until the inode struct in memory destruct. That is because > an open with flags other than O_RDONLY will clear NFS_INO_FSCACHE flag. My > question is, isn't it too strict? Or why fscache can't be a cache for both > reading and writing data just like page cache? It could, and for kAFS, it does. The problem is one of working out how best to handle coherency. This is even true of the NFS pagecache. If you make a write, and that write is written to the server, how do you know that someone else didn't make a write that was committed to disk immediately before yours? The fact that you've done a write to the server means that you can no longer be certain about the state of your cached copy of the file. NFSv4 has an alleviating factor for this: a change ID - but this is only useful if the NFS server and the underlying storage for that server actually put real, useful information in it. It's on my to do list to permit caching of NFS files that are opened for writing. Given that the same problem exists in the pagecache, I think my response is going to have to be "well don't do that, then - use file locking". David -- Linux-cachefs mailing list Linux-cachefs@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/linux-cachefs