NLM_LOCK - Establish a Lock
-
-
struct nlm_lockargs {
netobj cookie;
bool block;
bool exclusive;
struct nlm_lock alock;
bool reclaim;
int state;
};
-
-
struct nlm_res {
netobj cookie;
nlm_stat stat;
};
-
-
nlm_res
NLM_LOCK(nlm_lockargs) = 2;
This procedure attempts to establish a monitored lock described in "alock".
If "block" is true, then if the lock request cannot be granted
immediately the server will return a status of "LCK_BLOCKED" for this procedure call. When the request can be granted, the server will make a call-back to the client with the NLM_GRANTED procedure call. If "block" is set to false, and the lock cannot be granted immediately, the procedure will return with a status of LCK_DENIED, and no NLM_GRANTED call-back will be made. If "reclaim" is true, then the server will assume this is a request to re-establish a previous lock (for example, after the server has crashed and rebooted). During the grace period the server will only accept locks with "reclaim" set to true.
"state" contains the state of the client's NSM. This information is kept by the server implementation, so if the client crashes, the server can determine which locks to discard by checking this state against the state in the crash notification (SM_NOTIFY) sent by the NSM. See
File Locking over XNFS .
When the procedure returns, "stat" will be set to one of the following values:
- LCK_GRANTED
- Indicates that the procedure completed successfully, the lock was granted.
- LCK_DENIED
- Indicates that the procedure failed because the request conflicted with existing lock reservations for the file.
- LCK_DENIED_NOLOCKS
Indicates that the procedure failed because the server NLM could not allocate the resources needed to process the request.
- LCK_BLOCKED
- Indicates the blocking request cannot be granted immediately. The server NLM will make a call-back to the client with an NLM_GRANTED procedure when the lock can be granted.
- LCK_DENIED_GRACE_PERIOD
Indicates that the procedure failed because the server host has recently been rebooted and the server NLM is re-establishing existing locks, and is not yet ready to accept normal service requests.
Contents | Next section | Index |