Commit cd924aaa authored by Tigran Mkrtchyan's avatar Tigran Mkrtchyan
Browse files

nfs42: fix NFSERR_BAD_STATEID for server side copy with locks

Motivation:
As COPY operation can be called on files when locks are held, then
instead of open state ids the COPY will be called with lock state ids.

Modification:
Update COPY operation to use open state ids when file open modes are
checked.

Result:
passing NFS compatibility tests.

Acked-by: Lea Morschel
Target: master, 0.23
parent d53c02ea
Pipeline #26384 passed with stage
in 1 minute and 37 seconds
......@@ -88,8 +88,14 @@ public class OperationCOPY extends AbstractNFSv4Operation {
NFS4Client client = context.getSession().getClient();
int srcAccess = context.getStateHandler().getFileTracker().getShareAccess(client, srcInode, _args.opcopy.ca_src_stateid);
int dstAccess = context.getStateHandler().getFileTracker().getShareAccess(client, dstInode, _args.opcopy.ca_dst_stateid);
NFS4State srcState = client.state(_args.opcopy.ca_src_stateid);
NFS4State dstState = client.state(_args.opcopy.ca_dst_stateid);
int srcAccess = context.getStateHandler().getFileTracker()
.getShareAccess(client, srcInode, srcState.getOpenState().stateid());
int dstAccess = context.getStateHandler().getFileTracker()
.getShareAccess(client, dstInode, dstState.getOpenState().stateid());
if ((srcAccess & nfs4_prot.OPEN4_SHARE_ACCESS_READ) == 0) {
throw new OpenModeException("Invalid source inode open mode (required read)");
......
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