[OpenAFS] Force client to cache directory

Simon Wilkinson sxw@inf.ed.ac.uk
Mon, 4 Jan 2010 20:50:23 +0000

On 4 Jan 2010, at 18:14, Marc Dionne wrote:
> But that wouldn't keep the file contents up to date, would it?

You need to actually read all of the file contents. In theory, you  
only need to read a byte from each chunk of the file, but in practice  
something like cat >/dev/null (as suggested by other posters) is  
easier. There are some gotchas here, though:
   *) You need a client with disconnected mode support. The latest  
1.5.x client, built with --enable-disconnected is your best bet
   *) When the server goes away, you need to manually turn on  
disconnected mode. When the server comes back, you need to turn off  
disconnected mode. Disconnection is global - you won't contact any  
servers while its enabled, whether they're up or down.
   *) You need to make sure that your cache is large enough (both in  
data, and in 'stat' structures) to accommodate the data you're  
caching. Otherwise, you'll be evicting the first data you fetched  
before you've completed the run. stat structures are particularly  
important - you need all of the metadata necessary to access the file  
(both for the file itself, and all of the directories leading to it)  
in order to be able to use it when disconnected.
   *) You need to make sure that everything you want to use whilst  
disconnected has current callbacks at the moment you disconnect. This  
means that you'll want to run your update script regularly. It also  
means that you want to make sure that the fileserver has enough  
callbacks that it isn't breaking callbacks prematurely.

> There's been some discussion about implementing an "fs [un]pin"
> feature (see http://www.dementia.org/twiki/bin/view/AFSLore/OpenAFSCachePinning)
> in conjunction with disconnected mode, but I don't know if there's
> been any recent progress.

Yes. This is specifically designed to solve this problem. The idea is  
that you will give the cache manager a list of files, and it will  
ensure that it always has a current callback for that file. There's a  
design, but no code that I'm aware of as yet.