use of org.dcache.nfs.v4.xdr.LAYOUTCOMMIT4args in project dcache by dCache.
the class NFSv41Door method layoutCommit.
@Override
public OptionalLong layoutCommit(CompoundContext context, LAYOUTCOMMIT4args args) throws IOException {
final stateid4 stateid = Stateids.getCurrentStateidIfNeeded(context, args.loca_stateid);
final NFS4Client client = context.getStateHandler().getClientIdByStateId(stateid);
final NFS4State layoutState = client.state(stateid);
final NFS4State openState = layoutState.getOpenState();
Inode nfsInode = context.currentInode();
_log.debug("Committing layout by stateid: {}, open-state: {}", stateid, openState.stateid());
if (args.loca_last_write_offset.no_newoffset) {
long currentSize = _chimeraVfs.getattr(nfsInode).getSize();
long newSize = args.loca_last_write_offset.no_offset.value + 1;
if (newSize > currentSize) {
Stat newStat = new Stat();
newStat.setSize(newSize);
_chimeraVfs.setattr(nfsInode, newStat);
_vfsCache.invalidateStatCache(nfsInode);
return OptionalLong.of(newSize);
}
}
return OptionalLong.empty();
}
Aggregations