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 --- fs/nfsd/netns.h | 2 +- fs/nfsd/nfs4callback.c | 2 +- fs/nfsd/nfs4state.c | 6 +++--- fs/nfsd/nfsctl.c | 4 ++-- 4 files changed, 7 insertions(+), 7 deletions(-)
diff --git a/fs/nfsd/netns.h b/fs/nfsd/netns.h index d5cce15..85b114f 100644 --- a/fs/nfsd/netns.h +++ b/fs/nfsd/netns.h @@ -94,7 +94,7 @@ struct nfsd_net { bool in_grace; struct nfsd4_client_tracking_ops *client_tracking_ops;
- time_t nfsd4_lease; + u32 nfsd4_lease; time_t nfsd4_grace;
bool nfsd_net_up; diff --git a/fs/nfsd/nfs4callback.c b/fs/nfsd/nfs4callback.c index e7f50c4..8a177c6 100644 --- a/fs/nfsd/nfs4callback.c +++ b/fs/nfsd/nfs4callback.c @@ -681,7 +681,7 @@ static const struct rpc_program cb_program = { static int max_cb_time(struct net *net) { struct nfsd_net *nn = net_generic(net, nfsd_net_id); - return max(nn->nfsd4_lease/10, (time_t)1) * HZ; + return max(nn->nfsd4_lease/10, (u32)1) * HZ; }
static struct rpc_cred *callback_cred; diff --git a/fs/nfsd/nfs4state.c b/fs/nfsd/nfs4state.c index 8245236..4bceb878 100644 --- a/fs/nfsd/nfs4state.c +++ b/fs/nfsd/nfs4state.c @@ -4332,8 +4332,8 @@ nfs4_laundromat(struct nfsd_net *nn) struct nfs4_delegation *dp; struct nfs4_ol_stateid *stp; struct list_head *pos, *next, reaplist; - time_t cutoff = get_seconds() - nn->nfsd4_lease; - time_t t, new_timeo = nn->nfsd4_lease; + u32 cutoff = ktime_get_seconds() - nn->nfsd4_lease; + u32 t, new_timeo = nn->nfsd4_lease;
dprintk("NFSD: laundromat service - starting\n"); nfsd4_end_grace(nn); @@ -4399,7 +4399,7 @@ nfs4_laundromat(struct nfsd_net *nn) } spin_unlock(&nn->client_lock);
- new_timeo = max_t(time_t, new_timeo, NFSD_LAUNDROMAT_MINTIMEOUT); + new_timeo = max_t(u32, new_timeo, NFSD_LAUNDROMAT_MINTIMEOUT); return new_timeo; }
diff --git a/fs/nfsd/nfsctl.c b/fs/nfsd/nfsctl.c index 9690cb4..6e0cfd6 100644 --- a/fs/nfsd/nfsctl.c +++ b/fs/nfsd/nfsctl.c @@ -932,7 +932,7 @@ static ssize_t write_maxconn(struct file *file, char *buf, size_t size)
#ifdef CONFIG_NFSD_V4 static ssize_t __nfsd4_write_time(struct file *file, char *buf, size_t size, - time_t *time, struct nfsd_net *nn) + u32 *time, struct nfsd_net *nn) { char *mesg = buf; int rv, i; @@ -964,7 +964,7 @@ static ssize_t __nfsd4_write_time(struct file *file, char *buf, size_t size, }
static ssize_t nfsd4_write_time(struct file *file, char *buf, size_t size, - time_t *time, struct nfsd_net *nn) + u32 *time, struct nfsd_net *nn) { ssize_t rv;