Commit 5a36149f authored by Tigran Mkrtchyan's avatar Tigran Mkrtchyan
Browse files

nfs42: implement minimal nfs v4.2 server

Motivation:
according to rfc 7862 minimal nfs v4.2 server should accept minorversion
2 requests and can respond 'not supported' to all in the spec defined
operations.

Modification:
accept minorversion 2 and respond 'not supported' to

- ALLOCATE
- COPY
- COPY_NOTIFY
- DEALLOCATE
- IO_ADVISE
- OFFLOAD_CANCEL
- OFFLOAD_STATUS
- READ_PLUS
- SEEK
- WRITE_SAME
- CLONE

Result:

'Noop' spec compliant nfs 4.2 implementation

Acked-by: Lea Morschel
Target: master
parent 05f51790
/*
* Copyright (c) 2009 - 2019 Deutsches Elektronen-Synchroton,
* Copyright (c) 2009 - 2020 Deutsches Elektronen-Synchroton,
* Member of the Helmholtz Association, (DESY), HAMBURG, GERMANY
*
* This library is free software; you can redistribute it and/or modify
......@@ -19,8 +19,12 @@
*/
package org.dcache.nfs.v4;
import org.dcache.nfs.v4.xdr.nfs_argop4;
import org.dcache.nfs.v4.xdr.nfs_opnum4;
import org.dcache.nfs.ChimeraNFSException;
import org.dcache.nfs.nfsstat;
import org.dcache.nfs.v4.xdr.*;
import org.dcache.oncrpc4j.rpc.OncRpcException;
import java.io.IOException;
public class MDSOperationExecutor extends AbstractOperationExecutor {
......@@ -155,8 +159,25 @@ public class MDSOperationExecutor extends AbstractOperationExecutor {
return new OperationLISTXATTRS(op);
case nfs_opnum4.OP_REMOVEXATTR:
return new OperationREMOVEXATTR(op);
case nfs_opnum4.OP_ALLOCATE:
case nfs_opnum4.OP_COPY:
case nfs_opnum4.OP_COPY_NOTIFY:
case nfs_opnum4.OP_DEALLOCATE:
case nfs_opnum4.OP_IO_ADVISE:
case nfs_opnum4.OP_OFFLOAD_CANCEL:
case nfs_opnum4.OP_OFFLOAD_STATUS:
case nfs_opnum4.OP_READ_PLUS:
case nfs_opnum4.OP_SEEK:
case nfs_opnum4.OP_WRITE_SAME:
case nfs_opnum4.OP_CLONE:
// in V4.2 all operations are optional.
return new AbstractNFSv4Operation(op, op.argop) {
@Override
public void process(CompoundContext context, nfs_resop4 result) throws ChimeraNFSException, IOException, OncRpcException {
result.setStatus(nfsstat.NFSERR_NOTSUPP);
}
};
case nfs_opnum4.OP_ILLEGAL:
}
return new OperationILLEGAL(op);
......
/*
* Copyright (c) 2009 - 2019 Deutsches Elektronen-Synchroton,
* Copyright (c) 2009 - 2020 Deutsches Elektronen-Synchroton,
* Member of the Helmholtz Association, (DESY), HAMBURG, GERMANY
*
* This library is free software; you can redistribute it and/or modify
......@@ -114,7 +114,7 @@ public class NFSServerV41 extends nfs4_prot_NFS4_PROGRAM_ServerStub {
tag);
int minorversion = arg1.minorversion.value;
if (minorversion > 1) {
if (minorversion > 2) {
throw new MinorVersMismatchException(String.format("Unsupported minor version [%d]", arg1.minorversion.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