Linux NFS development
 help / color / mirror / Atom feed
* Force client page cache invalidation?
@ 2004-02-24 18:30 ralph gonzalez
  2004-02-24 20:06 ` trond.myklebust
  0 siblings, 1 reply; 5+ messages in thread
From: ralph gonzalez @ 2004-02-24 18:30 UTC (permalink / raw)
  To: nfs; +Cc: ralph gonzalez

We tend to run multiple applications on a single client, which all
mmap (usually readonly) the same file on an nfs-mounted volume.
If the file changes on the server, then we would like clients to
see these changes upon closing/reopening this file.

On Solaris (which we are moving from), this would work fine. However
Linux 2.4.22-10mdk (nfs utils 1.0.5) seems to be unwilling to reload
the file cache *when another application already has the file mmapped*.

Therefore each time the file is editted on the server, we have to
force all applications mapping this file (on the client in question)
to close the file *simultaneously*, and then allow them to reopen the
mapping.

*Question*: Instead, is there a way to force the client to reload
the file cache (exclusively for this file)? (So when we subsequently
close/open the file in each application asynchronously, they see the
correct pages.) Maybe there's a simple option or utility I'm missing?

A separate problem is that the file attributes are cached, so the
file cache is only reloaded if we force the client to reread the
file attributes whenever the file is editted on the server. This we
accomplish by the trick of locking/unlocking the file immediately
after opening it, to avoid disabling mount-level attribute caching
via the noac option.

Thanks for any suggestions!
-- 
Ralph Gonzalez
rgonzale@ibl.bm



-------------------------------------------------------
SF.Net is sponsored by: Speed Start Your Linux Apps Now.
Build and deploy apps & Web services for Linux with
a free DVD software kit from IBM. Click Now!
http://ads.osdn.com/?ad_id=1356&alloc_id=3438&op=click
_______________________________________________
NFS maillist  -  NFS@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/nfs

^ permalink raw reply	[flat|nested] 5+ messages in thread
* Re: Force client page cache invalidation?
@ 2004-02-25 14:05 ralph gonzalez
  0 siblings, 0 replies; 5+ messages in thread
From: ralph gonzalez @ 2004-02-25 14:05 UTC (permalink / raw)
  To: nfs

[snip]
 >> Linux 2.4.22-10mdk (nfs utils 1.0.5) seems to be unwilling to reload the
 >> file cache *when another application already has the file mmapped*.
 >
 > Which is quite sane semantics for mmap().

Agreed...

[snip]
 >>*Question*: Instead, is there a way to force the client to reload the
 >
 > file cache (exclusively for this file)? (So when we subsequently
 > close/open the file in each application asynchronously, they see the
 > correct pages.) Maybe there's a simple option or utility I'm missing?
 >
 > Linux does not support this sort of kludge and is unlikely to do so for
 > the near future. The VM simply cannot support it.
 >
 > In any case, the fact is that strict POSIX mmap() semantics assume
 > exclusive access to the file on the server while it is mapped on a given
 > client. If you're not providing that, then you are going to be prone to
 > some nasty races whether or not the cache invalidation works like Solaris
 > does.

I wasn't aware of the POSIX semantics. It's a shame, since we've been
using this approach -- multiple readers and single writer -- on Solaris
for 8 years with excellent stability and performance. When we switched to
Linux we found this unexpected and unfriendly behavior:

   If NFS client has the file mmapped while it is edited on the server,
   and the client then opens a second application which mmaps the file
   (without closing the first application), then no matter what you do
   -- close both clients, etc -- the file cache never releases the old
   pages!

-- 
Ralph Gonzalez
rgonzale@ibl.bm



-------------------------------------------------------
SF.Net is sponsored by: Speed Start Your Linux Apps Now.
Build and deploy apps & Web services for Linux with
a free DVD software kit from IBM. Click Now!
http://ads.osdn.com/?ad_id=1356&alloc_id=3438&op=click
_______________________________________________
NFS maillist  -  NFS@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/nfs

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2004-02-26 12:37 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-02-24 18:30 Force client page cache invalidation? ralph gonzalez
2004-02-24 20:06 ` trond.myklebust
2004-02-26  8:57   ` Olaf Kirch
2004-02-26 12:35     ` trond.myklebust
  -- strict thread matches above, loose matches on Subject: below --
2004-02-25 14:05 ralph gonzalez

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox