Subject: [nfsv4] StateId Semantics

From: namit jain <[email-masked]>
Date: Mon, 29 Dec 2003 17:36:41 -0800 (PST)

I needed some clarification on stateid's.

A Stateid is returned by OPEN and LOCK operation. Can
a single user have multiple stateids for the same file
(due to multiple locks on the same file), or is the 
same stateid returned to him by the server for a given
file ? 

The user passes the stateid during a READ and a WRITE.
Can he pass any stateid, or he has to pass the stateid
corresponding to the lock which allows him to
READ/WRITE the specified range ?

Thanks,
-namit

__________________________________
Do you Yahoo!?
New Yahoo! Photos - easier uploading and sharing.
http://photos.yahoo.com/

_______________________________________________
nfsv4 mailing list
[email-masked]
https://www1.ietf.org/mailman/listinfo/nfsv4

---

From: "Noveck, Dave" <[email-masked]>
Date: Mon, 5 Jan 2004 07:01:41 -0800

> same stateid returned to him by the server for a given

I want to clarify 'single user'.  "User" normally means 
the security identity which isn't relevant in this context.

Stateid's are assigned to owners, openowners and lockowners.
One way of thinking about owners are that they are like 
processes in that they are the contending sources of
open and lock requests.

Because openowners and lockowners are separate, a given
process may have one stateid for a file as an openowner
(which it got from OPEN or OPEN_DOWNGRADE) and another
for the file as a lockowner (which it got from LOCK or
LOCKU).

Leaving aside the openowner/lockowner distinction, a 
given owner will have only one valid stateid for a given
file at a given time.  So, as he does locking operations,
he gets new stateids which supersede the old ones.  The
new ones represent the entirety of the locking state
(or the open state) for that owner for that file and not
just the most recent operation which returned it.  

> READ/WRITE the specified range ?

He should pass the most recent stateid for the current 
owner (i.e. process) for that file.  If, as in most cases, 
processes, lockowners,and openowners are in a 1-to-1-to-1 
relationship, he will pass an open stateid if he has done 
no byte-range locking and the most recent lock stateid otherwise.  
It is valid (i.e. not an error) to pass the open stateid even 
if your process has done locking but in that case, your 
request will be treated as issued by an anonymous lockowner,
i.e. some unknown process that has done no byte-range
locking for the file in question.