Re: random locking questions
David Robinson <David.Robinson <at> Sun.COM>
2003-06-02 23:25:16 GMT
[IBM sure asks a lot of locking questions...]
Ronald E Bretschneider wrote:
> 1. I assume that NFS V4 does not preclude reads and writes without a
> preceeding open. I.e. a client could issue V4 lookup operation to determine
> a file handle and then use it with stateid of 0s or 1s to read or write. Is
> it correct to allow this behavior? Is this valid only to an advisory
> locking file?
Yes, and Maybe. Bottom line is that a server may reject any use
of all 0's or all 1's stateids for any reason. But it is expected
that doing I/O via a LOOKUP and READ/WRITE without an OPEN will
generally be allowed. It is up to the server to determine how it
interacts with other locking mechanisms and if it will allow
it in the face of an outstanding lock, be it mandatory or advisory.
The design encourages I/O operations that will not corrupt an
active lock, such as reading a read or write locked file but not
allowing a write to a file with any locks. But again, it is up to
the server to define the behavior.
> 1. if we allow V4 read or write without open to a mandatory locking
> file, I assume that we get a share reservation for the duration of the
> read or write request. Is this correct?
No, there are no "implicit" locks for any operation (this was hinted in
early drafts that just confused things). How the server allows
interaction from a client without an OPEN to one with a current share
resv is server defined. Some servers may never cause a request to be
denied, other may always. In general, share reservations are orthogonal
to byte range locks, one controls access to OPEN a file, the other