Skip to content

Commit cd924aa

Browse files
committed
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
1 parent d53c02e commit cd924aa

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

core/src/main/java/org/dcache/nfs/v4/OperationCOPY.java

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -88,8 +88,14 @@ public void process(CompoundContext context, nfs_resop4 result) throws ChimeraNF
8888

8989
NFS4Client client = context.getSession().getClient();
9090

91-
int srcAccess = context.getStateHandler().getFileTracker().getShareAccess(client, srcInode, _args.opcopy.ca_src_stateid);
92-
int dstAccess = context.getStateHandler().getFileTracker().getShareAccess(client, dstInode, _args.opcopy.ca_dst_stateid);
91+
NFS4State srcState = client.state(_args.opcopy.ca_src_stateid);
92+
NFS4State dstState = client.state(_args.opcopy.ca_dst_stateid);
93+
94+
int srcAccess = context.getStateHandler().getFileTracker()
95+
.getShareAccess(client, srcInode, srcState.getOpenState().stateid());
96+
97+
int dstAccess = context.getStateHandler().getFileTracker()
98+
.getShareAccess(client, dstInode, dstState.getOpenState().stateid());
9399

94100
if ((srcAccess & nfs4_prot.OPEN4_SHARE_ACCESS_READ) == 0) {
95101
throw new OpenModeException("Invalid source inode open mode (required read)");

0 commit comments

Comments
 (0)