Subject: RE: I found the lock related email

From: "Noveck, Dave" <[email-masked]>
Date: Mon, 29 Jul 2002 07:08:23 -0700

Dvid Robinson wrote (in part):
> So, the
> client making a locking state change request would increment the
> stateid to provide at-most-once semantics, the server upon making
> the state change would return a new stateid value. 

I think you meant to say that the client would increment the seqid 
value.

> The seqid must
> be an increasing integer, the stateid could in theory be any
> value as it is opaque from the clients perspective.

The opacity of the stateid is one thing that has changed a
little bit.  The stateid now has an opaque part and a sequence
part that changes with lock/unlock/open/open-downgrade and is 
not opaque.  While most clients could treat the whole thing as 
opaque, there are situations in which clients might want to look
at the sequence part.  Potentially, this also makes it a little
easier for network snooping tools, in that they have a way of 
knowing a priori that two stateid's belong to the same stateid 
sequence and what their proper order is.

Suppose you have a multi-threaded application in which many 
threads of control issue requests, all as part of a single
lockowner.  When OPEN's are issued, you have the option of
only having one OPEN outstanding at a time, but if you choose
not to do that (and in some cases that might be too onerous),
you can have multiple OPEN's outstanding as long as you single-
thread the process of generating the (with the appropriate
seqid), but not single-thread the process of waiting for the
response.  So in that case, there would be multiple OPEN's
in-flight with the order of processing enforced by the
seqid's in the request.  However, the replies may arrive
back at the client out-of-order.  In most cases (you are
opening different files) that doesn't matter.  However, becase
of hard links (what a great idea they were), you don't know 
if two request are opening the same file until they return.
So a client which sees the same stateid come in with a lower
sequence could determine that that stateid is out-of-date 
compared to the one already received.