Commit 7a5978db authored by Tigran Mkrtchyan's avatar Tigran Mkrtchyan
Browse files

nfsv41: pNFS: fix IO on special files

By having chimera as a backend file system we need to support
legacy .(xx)(xx)... commands. While there are no DS wich can be used
MDS have to redict requests to itself.
parent 74c8aabb
......@@ -101,7 +101,15 @@ public class MDSOperationFactory implements NFSv4OperationFactory {
case nfs_opnum4.OP_GETDEVICEINFO:
return new OperationGETDEVICEINFO(op);
case nfs_opnum4.OP_EXCHANGE_ID:
return new OperationEXCHANGE_ID(op, nfs4_prot.EXCHGID4_FLAG_USE_PNFS_MDS);
/*
* By having chimera as a backend file system we need to support
* legacy .(xx)(xx)... commands. To allow read of those files,
* MDS ( nfsv41 door ) have to declare itself as a data server (DS).
*
* indicate that we are a MDS and DS at the same time.
*/
return new OperationEXCHANGE_ID(op, nfs4_prot.EXCHGID4_FLAG_USE_PNFS_MDS|
nfs4_prot.EXCHGID4_FLAG_USE_PNFS_DS);
case nfs_opnum4.OP_CREATE_SESSION:
return new OperationCREATE_SESSION(op);
case nfs_opnum4.OP_DESTROY_SESSION:
......
......@@ -44,8 +44,15 @@ public class OperationREAD extends AbstractNFSv4Operation {
throw new ChimeraNFSException( nfsstat4.NFS4ERR_ACCESS, "Permission denied." );
}
NFSv4StateHandler.getInstace().updateClientLeaseTime(_args.opread.stateid);
if(context.getMinorversion() == 0) {
/*
* The NFSv4.0 spec requires to update lease time as long as
* client needs the file. This is done through READ, WRITE
* and RENEW opertations. With introduction of sessions in
* v4.1 update of the lease time done through SEQUENCE operation.
*/
NFSv4StateHandler.getInstace().updateClientLeaseTime(_args.opread.stateid);
}
long offset = _args.opread.offset.value.value;
......@@ -58,6 +65,12 @@ public class OperationREAD extends AbstractNFSv4Operation {
throw new IOHimeraFsException("IO not allowd");
}
/*
* While we have written directly into back-end byte array
* tell the byte buffer the actual position.
*/
buf.position(bytesReaded);
res.status = nfsstat4.NFS4_OK;
res.resok4 = new READ4resok();
......
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