[OpenAFS] WRITE-ON-CLOSE

John Hascall john@iastate.edu
Thu, 12 Jul 2007 09:44:41 CDT


> Hi ,
> Is "write-on-close" something i can count on ?
> More precisely i need to get from an afs client a file created
> from another client and i wonder how can i be sure that the file
> is not truncated.

A fairly standard technique is to use a temp-name while
writing the file then rename the file when done (and the
client looking for the file is looking for the final name).

For example:

  client-1:                                  client-2:

     pgm-to-make-file > tempname             while [ ! -f finalname ] sleep 5
     mv tempname finalname                   pgm-to-use-file < finalname

John