YAMAMOTO Takashi <[email protected]> wrote:

> > +                       rvap->va_size = MAX(rvap->va_size, vp->v_size);
> > + 
> couldn't it be a problem if the size of the file is shrinked by the server?

I am back to this simple fix, after the failure of attempts to avoid
uvm_vnp_setsize() calls from puffs_vnop_getattr() while a
PUFFS_VN_SETATTR is in progress. 

Keeping track of the end of a PUFFS_VN_SETATTR operation turns to be
troublesome. The operation needs to be asynchronous when done by a
kernel thread responsible for freeing memory, otherwise we get a
deadlock. Using puffs_msg_setcall() to get notified of completion does
not help, as soon as I use it, the machine hangs on low memory
situation.

Keeping MAX(rvap->va_size, vp->v_size) in puffs_vnop_getattr() is simple
but it has a drawback with distributed filesystems: a client will not
notify that an open file was shrunk by another client. I think this is
better than deadlocks and data corruption. 

If nobody has a better idea, I will got with this simple fix.

-- 
Emmanuel Dreyfus
http://hcpnet.free.fr/pubz
[email protected]

Reply via email to