The last request time is stored as an 'unsigned long', which is good enough until 2106, but it is then converted to 'long' in some places, which overflows in 2038.
This changes the type to time64_t to avoid those problems.
Signed-off-by: Arnd Bergmann arnd@arndb.de --- .../staging/lustre/lustre/include/lustre_export.h | 5 ++--- drivers/staging/lustre/lustre/obdclass/genops.c | 6 +++--- drivers/staging/lustre/lustre/ptlrpc/pinger.c | 22 +++++++++++----------- drivers/staging/lustre/lustre/ptlrpc/service.c | 10 +++++----- 4 files changed, 21 insertions(+), 22 deletions(-)
diff --git a/drivers/staging/lustre/lustre/include/lustre_export.h b/drivers/staging/lustre/lustre/include/lustre_export.h index e02a39a721d6..b06ee9ff22ae 100644 --- a/drivers/staging/lustre/lustre/include/lustre_export.h +++ b/drivers/staging/lustre/lustre/include/lustre_export.h @@ -180,7 +180,7 @@ struct obd_export { /** Last committed transno for this export */ __u64 exp_last_committed; /** When was last request received */ - unsigned long exp_last_request_time; + time64_t exp_last_request_time; /** On replay all requests waiting for replay are linked here */ struct list_head exp_req_replay_queue; /** @@ -268,8 +268,7 @@ static inline int exp_connect_multibulk(struct obd_export *exp) static inline int exp_expired(struct obd_export *exp, long age) { LASSERT(exp->exp_delayed); - return time_before(cfs_time_add(exp->exp_last_request_time, age), - get_seconds()); + return exp->exp_last_request_time + age < ktime_get_real_seconds(); }
static inline int exp_connect_cancelset(struct obd_export *exp) diff --git a/drivers/staging/lustre/lustre/obdclass/genops.c b/drivers/staging/lustre/lustre/obdclass/genops.c index 594955d359ec..a27932502f2a 100644 --- a/drivers/staging/lustre/lustre/obdclass/genops.c +++ b/drivers/staging/lustre/lustre/obdclass/genops.c @@ -846,7 +846,7 @@ struct obd_export *class_new_export(struct obd_device *obd, INIT_LIST_HEAD(&export->exp_handle.h_link); INIT_LIST_HEAD(&export->exp_hp_rpcs); class_handle_hash(&export->exp_handle, &export_handle_ops); - export->exp_last_request_time = get_seconds(); + export->exp_last_request_time = ktime_get_real_seconds(); spin_lock_init(&export->exp_lock); spin_lock_init(&export->exp_rpc_lock); INIT_HLIST_NODE(&export->exp_uuid_hash); @@ -1266,9 +1266,9 @@ static void class_disconnect_export_list(struct list_head *list, }
class_export_get(exp); - CDEBUG(D_HA, "%s: disconnecting export at %s (%p), last request at " CFS_TIME_T "\n", + CDEBUG(D_HA, "%s: disconnecting export at %s (%p), last request at %lld\n", exp->exp_obd->obd_name, obd_export_nid2str(exp), - exp, exp->exp_last_request_time); + exp, (s64)exp->exp_last_request_time); /* release one export reference anyway */ rc = obd_disconnect(exp);
diff --git a/drivers/staging/lustre/lustre/ptlrpc/pinger.c b/drivers/staging/lustre/lustre/ptlrpc/pinger.c index 6cd4cfa58c27..76eecb02d1fc 100644 --- a/drivers/staging/lustre/lustre/ptlrpc/pinger.c +++ b/drivers/staging/lustre/lustre/ptlrpc/pinger.c @@ -572,7 +572,7 @@ static int ping_evictor_main(void *arg) struct obd_device *obd; struct obd_export *exp; struct l_wait_info lwi = { 0 }; - time_t expire_time; + time64_t expire_time;
unshare_fs_struct();
@@ -594,10 +594,10 @@ static int ping_evictor_main(void *arg) obd_evict_list); spin_unlock(&pet_lock);
- expire_time = get_seconds() - PING_EVICT_TIMEOUT; + expire_time = ktime_get_real_seconds() - PING_EVICT_TIMEOUT;
- CDEBUG(D_HA, "evicting all exports of obd %s older than %ld\n", - obd->obd_name, expire_time); + CDEBUG(D_HA, "evicting all exports of obd %s older than %lld\n", + obd->obd_name, (s64)expire_time);
/* Exports can't be deleted out of the list while we hold * the obd lock (class_unlink_export), which means we can't @@ -611,17 +611,17 @@ static int ping_evictor_main(void *arg) if (expire_time > exp->exp_last_request_time) { class_export_get(exp); spin_unlock(&obd->obd_dev_lock); - LCONSOLE_WARN("%s: haven't heard from client %s (at %s) in %ld seconds. I think it's dead, and I am evicting it. exp %p, cur %ld expire %ld last %ld\n", + LCONSOLE_WARN("%s: haven't heard from client %s (at %s) in %ld seconds. I think it's dead, and I am evicting it. exp %p, cur %lld expire %lld last %lld\n", obd->obd_name, obd_uuid2str(&exp->exp_client_uuid), obd_export_nid2str(exp), - (long)(get_seconds() - + (long)(ktime_get_real_seconds() - exp->exp_last_request_time), - exp, (long)get_seconds(), - (long)expire_time, - (long)exp->exp_last_request_time); - CDEBUG(D_HA, "Last request was at %ld\n", - exp->exp_last_request_time); + exp, (s64)ktime_get_real_seconds(), + (s64)expire_time, + (s64)exp->exp_last_request_time); + CDEBUG(D_HA, "Last request was at %lld\n", + (s64)exp->exp_last_request_time); class_fail_export(exp); class_export_put(exp); spin_lock(&obd->obd_dev_lock); diff --git a/drivers/staging/lustre/lustre/ptlrpc/service.c b/drivers/staging/lustre/lustre/ptlrpc/service.c index c7c6cff80450..7766bb8b352a 100644 --- a/drivers/staging/lustre/lustre/ptlrpc/service.c +++ b/drivers/staging/lustre/lustre/ptlrpc/service.c @@ -1034,7 +1034,7 @@ static void ptlrpc_server_finish_active_request( static void ptlrpc_update_export_timer(struct obd_export *exp, long extra_delay) { struct obd_export *oldest_exp; - time_t oldest_time, new_time; + time64_t oldest_time, new_time;
LASSERT(exp);
@@ -1045,7 +1045,7 @@ static void ptlrpc_update_export_timer(struct obd_export *exp, long extra_delay) will make it to the top of the list. */
/* Do not pay attention on 1sec or smaller renewals. */ - new_time = get_seconds() + extra_delay; + new_time = ktime_get_real_seconds() + extra_delay; if (exp->exp_last_request_time + 1 /*second */ >= new_time) return;
@@ -1078,7 +1078,7 @@ static void ptlrpc_update_export_timer(struct obd_export *exp, long extra_delay) /* Note - racing to start/reset the obd_eviction timer is safe */ if (exp->exp_obd->obd_eviction_timer == 0) { /* Check if the oldest entry is expired. */ - if (get_seconds() > (oldest_time + PING_EVICT_TIMEOUT + + if (ktime_get_real_seconds() > (oldest_time + PING_EVICT_TIMEOUT + extra_delay)) { /* We need a second timer, in case the net was down and * it just came back. Since the pinger may skip every @@ -1086,9 +1086,9 @@ static void ptlrpc_update_export_timer(struct obd_export *exp, long extra_delay) * we better wait for 3. */ exp->exp_obd->obd_eviction_timer = ktime_get_real_seconds() + 3 * PING_INTERVAL; - CDEBUG(D_HA, "%s: Think about evicting %s from "CFS_TIME_T"\n", + CDEBUG(D_HA, "%s: Think about evicting %s from %lld\n", exp->exp_obd->obd_name, - obd_export_nid2str(oldest_exp), oldest_time); + obd_export_nid2str(oldest_exp), (s64)oldest_time); } } else { if (ktime_get_real_seconds() >