Coda File System

Re: Theory of writeback

From: Phil Nelson <phil_at_cs.wwu.edu>
Date: Fri, 23 Mar 2007 07:43:18 -0700
On Friday 23 March 2007 01:38, Martin Ginkel wrote:
> which calls have to happen: fopen("file","w"); close(), is a write()
> necessary. And when does this happen (the close() call?).

For the UNIX implementations, this is causes a writeback.   For the
Windows implementation it is not the case.   Early in the development
cycle I discovered that almost *everything* in Windows, especially
Windows explorer, opens files R/W.  And Windows explorer even opens
every file in a directory when one browses to that directory.  So
not only did a browse to a directory cause all file to be fetched
from the server, it also required a store back to the server just to
view the directory contents.

So, to try to limit this problem, the Windows kernel module does the
following:

   Open checks the permissions to make sure the process can open the
       file with the requested flags.
   Venus is then asked to open the file with R/O access.
   All reads then continue with no changes in file status.
   If write is called while the file is still open R/O, then the
       kernel module informs venus of the change in open status.

   So only if a write is performed on Windows does a file get sent back
to the server.  This does provide a window for a file to have its 
permissions changed between the open and the write, but this was the
only viable solution to make Coda usable on Windows.

   To close that window and possibly to help all implementations, we should
look at allowing open to proceed normally and getting R/W access to a file
and then have the kernel module record whether or not a write was performed
on the file.  Then add an argument to the close upcall that specifies whether
a write was performed.   If a write was not performed, then venus could just
close the file and cancel the writeback.

  I suspect that the windows problem of opening everything with R/w access
is going to become more of a problem on UNIX due desktop software trying to
be more "Windows like".

  --Phil

-- 
Phil Nelson                       NetBSD: http://www.NetBSD.org
e-mail: phil@cs.wwu.edu           Coda: http://www.coda.cs.cmu.edu
http://www.cs.wwu.edu/nelson 

Received on 2007-03-23 10:56:44