Subject: RE: mmap and locking (was "Caching proposal, take 2 (LONG)")

From: "Noveck, Dave" <[email-masked]>
Date: Wed, 11 Aug 1999 14:01:58 -0700

> Let me see if I understand your response.

I think you do.

> 
> 1. If the client has a write delegation, the client can write back
> whole mapped pages, even if there are locks that cover partial pages.

Yes.  Write delegation implies no other client can interfere.

> 2. If the file doesn't have any locks, the client must write dirty
> mmapped pages back on close, and it can write them back earlier if it
> chooses.  Writing whole pages is allowed.

Except that the client may not have to if he has a write delegation
and the file is within the filesize limit.  

> If there is sharing, and a
> write from the client clobbers a write from another client, it's the
> application's fault for not using locking.

I would express it in more value-free language.

NFS v4 provides a means of supporting applications which use locking
to co-ordinate their activities and does not have sufficient 
faciltiies to prevent interference among applications that don't
use locking or share reservations.

> 
> 3. If the file is locked and the client does not have a write
> delegation, it must write back exactly the contents of the locked
> region when the region is unlocked (or the file is closed).  If the
> region covers a partial page, the client must not write back the
> portion of the page that was not covered by the lock.

Yes.

> 
> If that's not what you meant, let me know what I missed.  It looks
> reasonable to me (though I'm not the person who will have to implement
> point 3 :-)).

I don't think that's so hard but since I'm not doing clients these
days, I won't be the one to implement it either.