On Tue, Nov 3, 2015 at 4:04 PM, Arnd Bergmann arnd@arndb.de wrote:
On Tuesday 27 October 2015 09:08:35 Ksenija Stanojevic wrote:
Replace time_t type and get_seconds function which are not y2038 safe on 32-bit systems. Function ktime_get_seconds use monotonic instead of real time and therefore will not cause overflow.
Signed-off-by: Ksenija Stanojevic ksenija.stanojevic@gmail.com
I don't think using monotonic time is safe here:
I was under the impression that comment:
* We're assuming the clid was not given out from a boot * precisely 2^32 (about 136 years) before this one. That seems * a safe assumption:
is implying that monotonic time is used (should be used).
diff --git a/fs/nfsd/nfs4state.c b/fs/nfsd/nfs4state.c index 0f1d569..8245236 100644 --- a/fs/nfsd/nfs4state.c +++ b/fs/nfsd/nfs4state.c @@ -1612,9 +1612,9 @@ STALE_CLIENTID(clientid_t *clid, struct nfsd_net *nn) * precisely 2^32 (about 136 years) before this one. That seems * a safe assumption: */
if (clid->cl_boot == (u32)nn->boot_time)
if (clid->cl_boot == nn->boot_time) return 0;
It looks like clid->cl_boot comes from a machine on the other side of the network, and we need to ensure that the values are unique above all things.
--- a/fs/nfsd/state.h +++ b/fs/nfsd/state.h @@ -305,7 +305,7 @@ struct nfs4_client { #endif struct xdr_netobj cl_name; /* id generated by client */ nfs4_verifier cl_verifier; /* generated by client */
time_t cl_time; /* time of last lease renewal */
u32 cl_time; /* time of last lease renewal */ struct sockaddr_storage cl_addr; /* client ipaddress */ bool cl_mach_cred; /* SP4_MACH_CRED in force */ struct svc_cred cl_cred; /* setclientid principal */
This change seems unrelated to the rest of this patch.
Arnd