[OpenAFS] Cache file status after Network error

Chaskiel Grundman cg2v@andrew.cmu.edu
Thu, 27 Mar 2008 10:28:39 -0400 (EDT)


On Tue, 25 Mar 2008, Harald Barth wrote:
> As we know, the data is first cached and then sent to the server on
> close(). If now the networks fails half way during the close, the
> close returns an error (which is OK), _but_ the file in the cache is
> considered valid on this client but may be in a different state on all
> the other clients.
It is supposed to be the case that when a file becomes unreferenced (goes 
"inactive" in bsd parlance) that dirty data is thrown away on the grounds 
that it can only still be around due to a write error.We really should not 
invalidate the data any sooner than that, since existing mmaps/etc may be 
referring to it.

It may be the case on linux that such dirty data is retained longer than 
it should be (because linux holds inode references in dentrys). Making 
afs_dentry_delete check for CDirty && opens==0 (that is, return true in 
that case) may fix this. if not, the next thing to try would be d_drop in 
afs_linux_release (again, if CDirty && opens==0), but that is probably 
racy.