Atomic file change checking
Russell Coker
russell at coker.com.au
Wed Nov 3 06:32:59 UTC 2004
On Wednesday 03 November 2004 09:33, Aaron Scott <scott.aaron at abc.net.au>
wrote:
> I have been trauling through kernel change logs looking for information
> about changes to NFS in the 2.6 kernel. Does any one know if the 2.6
> kernel does sub second checks for changes to a file that exists on an
> nfs share? I have a problem where there are a group of files that are
> read several times a second. When replacing the file, some times the
> file is read half way through the write and we get a cached copy of only
> part of the files. This isn't normally a problem until you need
> something like Apache to serve out html then the problem becomes
> evident.
If you replace the file instead of just changing the existing file then it
should work OK. Replacing the file gives a new Inode number and NFS caching
is based on Inodes...
If for example you use rsync to replace files on your web server (as I do when
updating my web pages) for each file a temporary file will be created and
then renamed to the correct name.
Just writing over an existing file has other issues. If the writer aborts for
some reason (process crash, power failure, etc) then you are left with
inconsistent data.
--
http://www.coker.com.au/selinux/ My NSA Security Enhanced Linux packages
http://www.coker.com.au/bonnie++/ Bonnie++ hard drive benchmark
http://www.coker.com.au/postal/ Postal SMTP/POP benchmark
http://www.coker.com.au/~russell/ My home page
More information about the fedora-test-list
mailing list