Skip to content

Commit

Permalink
nfs42: fix NFSERR_BAD_STATEID for server side copy with locks
Browse files Browse the repository at this point in the history
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
  • Loading branch information
kofemann committed Apr 27, 2022
1 parent d53c02e commit cd924aa
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions core/src/main/java/org/dcache/nfs/v4/OperationCOPY.java
Original file line number Diff line number Diff line change
Expand Up @@ -88,8 +88,14 @@ public void process(CompoundContext context, nfs_resop4 result) throws ChimeraNF

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)");
Expand Down

0 comments on commit cd924aa

Please sign in to comment.