Re: NFS still has caching problem

Bryn Paul Arnold Jones (bpaj@gytha.demon.co.uk)
Sun, 14 Jul 1996 13:48:18 +0100 (BST)


On Sat, 13 Jul 1996, Linus Torvalds wrote:

[...]
>
> Note that the "mtime" field is only tested when the NFS cache times out,
> because we don't want to invalidate the cache when we write to the file
> ourselves (*). The _size_ is checked a lot more often, because we can
> always compare the size of the local file and the size on the server.
>
> (*) We can't compare local mtime and server mtime for the simple reason
> that they are different things - local and server time need not be
> synchronized at all. Trying to make any decisions based on local and
> server times leads to all kinds of problems, including _never_ timing
> out the cache (very bad indeed), or timing out for no reason.
>
> If you take a look at how Linux NFS checks the "mtime", you'll notice
> that it never checks the local mtime against the server-reported mtime;
> "revalidate_inode()" checks the NFS_OLDMTIME against the server-reported
> mtime (and NFS_OLDMTIME is in "server time" rather than "local time").
>

Hmm, as long as the old server mtime, and the local mtime are the same,
we could check that the server's mtime against it's old mtime (ie we
havn't changed the file, so the server is posably more up to date than
the local cache, and we want to make sure noone else has changed it either).

or in proto code:

if(!we_changed_file){
look_see_if_someone_else_has_changed_the_file();
} else {
don't_check();
}

[...]
>
> Linus
>
Bryn

--
PGP key pass phrase forgotten,   \ Overload -- core meltdown sequence 
again :(                          |            initiated.
                                 / This space is intentionally left   
                                |  blank, apart from this text ;-)
                                 \____________________________________