Commit 1cf016b0 authored by Tigran Mkrtchyan's avatar Tigran Mkrtchyan
Browse files

nfs4: getattr should return lease time configured on state handler

Motivation:
if server uses another non default value for leas time, then value
returned by GETATTR is incorrect.

Modification:
introduce NFSv4StateHandler#getLeaseTime and use it to get the value of
FATTR4_LEASE_TIME attribute.

Result:
a server with non default lease time will return the correct value on
getattr.

Acked-by: Albert Rossi
Target: master
parent 248c8779
......@@ -408,4 +408,12 @@ public class NFSv4StateHandler {
return new sessionid4(id);
}
/**
* Get lease time value in seconds used by this state handler.
* @return lease time value in seconds.
*/
public int getLeaseTime() {
return _leaseTime;
}
}
/*
* 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
......@@ -230,7 +230,7 @@ public class OperationGETATTR extends AbstractNFSv4Operation {
case nfs4_prot.FATTR4_UNIQUE_HANDLES:
return Optional.of(new fattr4_unique_handles(true));
case nfs4_prot.FATTR4_LEASE_TIME:
return Optional.of(new fattr4_lease_time(NFSv4Defaults.NFS4_LEASE_TIME));
return Optional.of(new fattr4_lease_time(context.getStateHandler().getLeaseTime()));
case nfs4_prot.FATTR4_RDATTR_ERROR:
// this attribute provided by the readdir operation
return Optional.empty();
......
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