Skip to content

Commit 1832061

Browse files
committed
pnfs: drop IO mode check on layout commit
Motivation: As pNFS device manager is responsible for issuing layouts the nfs server can't match layout state ids to layouts, thus cant check the IO modes. Modification: Drop layout IO mode tests from the generic layoutcommit operation. Result: more responsibility on pNFS device manager Acked-by: Marina Sahakyan Target: master
1 parent 9288056 commit 1832061

File tree

2 files changed

+3
-18
lines changed

2 files changed

+3
-18
lines changed

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

Lines changed: 1 addition & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2009 - 2019 Deutsches Elektronen-Synchroton,
2+
* Copyright (c) 2009 - 2025 Deutsches Elektronen-Synchroton,
33
* Member of the Helmholtz Association, (DESY), HAMBURG, GERMANY
44
*
55
* This library is free software; you can redistribute it and/or modify
@@ -29,11 +29,8 @@
2929
import org.dcache.nfs.v4.xdr.LAYOUTCOMMIT4resok;
3030
import org.dcache.nfs.v4.xdr.LAYOUTCOMMIT4res;
3131
import org.dcache.nfs.ChimeraNFSException;
32-
import org.dcache.nfs.status.BadLayoutException;
3332
import org.dcache.nfs.status.NotSuppException;
34-
import org.dcache.nfs.v4.xdr.nfs4_prot;
3533
import org.dcache.nfs.v4.xdr.nfs_resop4;
36-
import org.dcache.nfs.v4.xdr.stateid4;
3734
import org.dcache.nfs.vfs.Inode;
3835
import org.slf4j.Logger;
3936
import org.slf4j.LoggerFactory;
@@ -56,20 +53,6 @@ public void process(CompoundContext context, nfs_resop4 result) throws ChimeraNF
5653
.orElseThrow(() -> new NotSuppException("pNFS device manager not configured"));
5754

5855
Inode inode = context.currentInode();
59-
NFS4Client client = context.getSession().getClient();
60-
stateid4 stateid = Stateids.getCurrentStateidIfNeeded(context, _args.oplayoutcommit.loca_stateid);
61-
62-
// will throw BAD_STATEID
63-
NFS4State state = client.state(stateid);
64-
65-
// changing file size requires open for writing
66-
int shareAccess = context.getStateHandler()
67-
.getFileTracker()
68-
.getShareAccess(client, inode, state.getOpenState().stateid());
69-
70-
if ((shareAccess & nfs4_prot.OPEN4_SHARE_ACCESS_WRITE) == 0) {
71-
throw new BadLayoutException("Invalid open mode");
72-
}
7356

7457
_log.debug("LAYOUTCOMMIT: inode={} length={} offset={} loca_last_write_offset={}",
7558
inode, _args.oplayoutcommit.loca_length.value,

core/src/test/java/org/dcache/nfs/v4/OperationLAYOUTCOMMITTest.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
import org.dcache.nfs.v4.xdr.nfs_fh4;
88
import org.dcache.nfs.vfs.Inode;
99
import org.junit.Before;
10+
import org.junit.Ignore;
1011
import org.junit.Test;
1112

1213
import org.dcache.nfs.v4.xdr.COMPOUND4args;
@@ -54,6 +55,7 @@ public void setUp() throws Exception {
5455
}
5556

5657
@Test(expected = BadLayoutException.class)
58+
@Ignore
5759
public void testCommitOnReadLayout() throws Exception {
5860

5961
StateOwner stateOwner = client.getOrCreateOwner("client1".getBytes(StandardCharsets.UTF_8), new seqid4(0));

0 commit comments

Comments
 (0)