Commit 417048fd authored by Tigran Mkrtchyan's avatar Tigran Mkrtchyan
Browse files

nfs4: fix client id validation of LOCKT operation

The LOCKT operation falsely assumes, that client id of a test operation
is not required to be valid.

Enforce clientid validity by querying state manager v4.0 or derive from
the session, for v4.1 and later.

Acked-by: Albert Rossi
Target: master
parent 93881f13
......@@ -71,14 +71,16 @@ public class OperationLOCKT extends AbstractNFSv4Operation {
try {
* this is a hypothetic lock owner, which used for lock-test and might
* not exist on the server.
state_owner4 hypotheticLockOwner = new state_owner4();
hypotheticLockOwner.clientid = _args.oplockt.owner.clientid;
hypotheticLockOwner.owner = _args.oplockt.owner.owner;
if (context.getMinorversion() == 0) {
// poke to check that client id is valid
hypotheticLockOwner.clientid = _args.oplockt.owner.clientid;
} else {
hypotheticLockOwner.clientid = context.getSession().getClient().getId();
StateOwner lockOwner = new StateOwner(hypotheticLockOwner, 0);
NlmLock lock = new NlmLock(lockOwner, _args.oplockt.locktype, _args.oplockt.offset.value, _args.oplockt.length.value);
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment