The adaptive timeout handling stores absolute times in 32-bit time_t quantities, which will overflow in 2038.
This changes it to use time64_t.
Signed-off-by: Arnd Bergmann arnd@arndb.de --- drivers/staging/lustre/lustre/include/lustre_import.h | 6 +++--- drivers/staging/lustre/lustre/obdclass/lprocfs_status.c | 8 ++++---- drivers/staging/lustre/lustre/ptlrpc/import.c | 8 ++++---- drivers/staging/lustre/lustre/ptlrpc/lproc_ptlrpc.c | 8 ++++---- 4 files changed, 15 insertions(+), 15 deletions(-)
diff --git a/drivers/staging/lustre/lustre/include/lustre_import.h b/drivers/staging/lustre/lustre/include/lustre_import.h index 99606387f904..cd6244ecd0c7 100644 --- a/drivers/staging/lustre/lustre/include/lustre_import.h +++ b/drivers/staging/lustre/lustre/include/lustre_import.h @@ -61,12 +61,12 @@ #define AT_FLG_NOHIST 0x1 /* use last reported value only */
struct adaptive_timeout { - time_t at_binstart; /* bin start time */ + time64_t at_binstart; /* bin start time */ unsigned int at_hist[AT_BINS]; /* timeout history bins */ unsigned int at_flags; unsigned int at_current; /* current timeout value */ unsigned int at_worst_ever; /* worst-ever timeout value */ - time_t at_worst_time; /* worst-ever timeout timestamp */ + time64_t at_worst_time; /* worst-ever timeout timestamp */ spinlock_t at_lock; };
@@ -351,7 +351,7 @@ static inline void at_reset(struct adaptive_timeout *at, int val) spin_lock(&at->at_lock); at->at_current = val; at->at_worst_ever = val; - at->at_worst_time = get_seconds(); + at->at_worst_time = ktime_get_real_seconds(); spin_unlock(&at->at_lock); } static inline void at_init(struct adaptive_timeout *at, int val, int flags) diff --git a/drivers/staging/lustre/lustre/obdclass/lprocfs_status.c b/drivers/staging/lustre/lustre/obdclass/lprocfs_status.c index 9887ce1d51e4..7cc0f54f9cd4 100644 --- a/drivers/staging/lustre/lustre/obdclass/lprocfs_status.c +++ b/drivers/staging/lustre/lustre/obdclass/lprocfs_status.c @@ -890,8 +890,8 @@ int lprocfs_rd_timeouts(struct seq_file *m, void *data) worst = imp->imp_at.iat_net_latency.at_worst_ever; worstt = imp->imp_at.iat_net_latency.at_worst_time; s2dhms(&ts, now - worstt); - seq_printf(m, "%-10s : cur %3u worst %3u (at %ld, "DHMS_FMT" ago) ", - "network", cur, worst, worstt, DHMS_VARS(&ts)); + seq_printf(m, "%-10s : cur %3u worst %3u (at %lld, "DHMS_FMT" ago) ", + "network", cur, worst, (s64)worstt, DHMS_VARS(&ts)); lprocfs_at_hist_helper(m, &imp->imp_at.iat_net_latency);
for (i = 0; i < IMP_AT_MAX_PORTALS; i++) { @@ -901,9 +901,9 @@ int lprocfs_rd_timeouts(struct seq_file *m, void *data) worst = imp->imp_at.iat_service_estimate[i].at_worst_ever; worstt = imp->imp_at.iat_service_estimate[i].at_worst_time; s2dhms(&ts, now - worstt); - seq_printf(m, "portal %-2d : cur %3u worst %3u (at %ld, " + seq_printf(m, "portal %-2d : cur %3u worst %3u (at %lld, " DHMS_FMT" ago) ", imp->imp_at.iat_portal[i], - cur, worst, worstt, DHMS_VARS(&ts)); + cur, worst, (s64)worstt, DHMS_VARS(&ts)); lprocfs_at_hist_helper(m, &imp->imp_at.iat_service_estimate[i]); }
diff --git a/drivers/staging/lustre/lustre/ptlrpc/import.c b/drivers/staging/lustre/lustre/ptlrpc/import.c index b6f38cbbc295..3fc49ee66d8b 100644 --- a/drivers/staging/lustre/lustre/ptlrpc/import.c +++ b/drivers/staging/lustre/lustre/ptlrpc/import.c @@ -1523,12 +1523,12 @@ extern unsigned int at_min, at_max, at_history; int at_measured(struct adaptive_timeout *at, unsigned int val) { unsigned int old = at->at_current; - time_t now = get_seconds(); - time_t binlimit = max_t(time_t, at_history / AT_BINS, 1); + time64_t now = ktime_get_real_seconds(); + long binlimit = max_t(long, at_history / AT_BINS, 1);
LASSERT(at); CDEBUG(D_OTHER, "add %u to %p time=%lu v=%u (%u %u %u %u)\n", - val, at, now - at->at_binstart, at->at_current, + val, at, (long)(now - at->at_binstart), at->at_current, at->at_hist[0], at->at_hist[1], at->at_hist[2], at->at_hist[3]);
if (val == 0) @@ -1553,7 +1553,7 @@ int at_measured(struct adaptive_timeout *at, unsigned int val) int i, shift; unsigned int maxv = val; /* move bins over */ - shift = (now - at->at_binstart) / binlimit; + shift = (u32)(now - at->at_binstart) / binlimit; LASSERT(shift > 0); for (i = AT_BINS - 1; i >= 0; i--) { if (i >= shift) { diff --git a/drivers/staging/lustre/lustre/ptlrpc/lproc_ptlrpc.c b/drivers/staging/lustre/lustre/ptlrpc/lproc_ptlrpc.c index 9a10baf711b0..477cc4da31a4 100644 --- a/drivers/staging/lustre/lustre/ptlrpc/lproc_ptlrpc.c +++ b/drivers/staging/lustre/lustre/ptlrpc/lproc_ptlrpc.c @@ -990,7 +990,7 @@ static int ptlrpc_lprocfs_timeouts_seq_show(struct seq_file *m, void *n) struct ptlrpc_service *svc = m->private; struct ptlrpc_service_part *svcpt; struct dhms ts; - time_t worstt; + time64_t worstt; unsigned int cur; unsigned int worst; int i; @@ -1005,11 +1005,11 @@ static int ptlrpc_lprocfs_timeouts_seq_show(struct seq_file *m, void *n) cur = at_get(&svcpt->scp_at_estimate); worst = svcpt->scp_at_estimate.at_worst_ever; worstt = svcpt->scp_at_estimate.at_worst_time; - s2dhms(&ts, get_seconds() - worstt); + s2dhms(&ts, ktime_get_real_seconds() - worstt);
- seq_printf(m, "%10s : cur %3u worst %3u (at %ld, " + seq_printf(m, "%10s : cur %3u worst %3u (at %lld, " DHMS_FMT" ago) ", "service", - cur, worst, worstt, DHMS_VARS(&ts)); + cur, worst, (s64)worstt, DHMS_VARS(&ts));
lprocfs_at_hist_helper(m, &svcpt->scp_at_estimate); }