#define CFS_TICK 1
-/*
- * return valid time-out based on user supplied one. Currently we only check
- * that time-out is not shorted than allowed.
- */
-static inline cfs_duration_t cfs_timeout_cap(cfs_duration_t timeout)
-{
- if (timeout < CFS_TICK)
- timeout = CFS_TICK;
- return timeout;
-}
-
#endif
* cfs_time_t cfs_time_current(void);
* cfs_time_t cfs_time_add (cfs_time_t, cfs_duration_t);
* cfs_duration_t cfs_time_sub (cfs_time_t, cfs_time_t);
- * int cfs_impl_time_before (cfs_time_t, cfs_time_t);
- * int cfs_impl_time_before_eq(cfs_time_t, cfs_time_t);
- *
- * cfs_duration_t cfs_duration_build(int64_t);
*
* time_t cfs_duration_sec (cfs_duration_t);
- * void cfs_duration_usec(cfs_duration_t, struct timeval *);
- * void cfs_duration_nsec(cfs_duration_t, struct timespec *);
- *
- * CFS_TIME_FORMAT
- * CFS_DURATION_FORMAT
- *
*/
-#define ONE_BILLION ((u_int64_t)1000000000)
-#define ONE_MILLION 1000000
-
-#ifndef __KERNEL__
-#error This include is only for kernel use.
-#endif
-
#include <linux/module.h>
#include <linux/kernel.h>
#include <linux/version.h>
return (__s64)t2 - (__s64)t1 >= 0;
}
-/*
- * One jiffy
- */
-#define CFS_DURATION_T "%ld"
-
#endif /* __LIBCFS_LINUX_LINUX_TIME_H__ */
/** Last committed transno for this export */
__u64 exp_last_committed;
/** When was last request received */
- cfs_time_t 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;
/**
return exp_max_brw_size(exp) > ONE_MB_BRW_SIZE;
}
-static inline int exp_expired(struct obd_export *exp, cfs_duration_t age)
-{
- LASSERT(exp->exp_delayed);
- return cfs_time_before(cfs_time_add(exp->exp_last_request_time, age),
- cfs_time_current_sec());
-}
-
static inline int exp_connect_cancelset(struct obd_export *exp)
{
LASSERT(exp != NULL);
*/
struct lustre_handle imp_remote_handle;
/** When to perform next ping. time in jiffies. */
- cfs_time_t imp_next_ping;
+ time64_t imp_next_ping;
/** When we last successfully connected. time in 64bit jiffies */
__u64 imp_last_success_conn;
void ptlrpc_server_drop_request(struct ptlrpc_request *req);
void ptlrpc_request_change_export(struct ptlrpc_request *req,
struct obd_export *export);
-void ptlrpc_update_export_timer(struct obd_export *exp, long extra_delay);
+void ptlrpc_update_export_timer(struct obd_export *exp,
+ time64_t extra_delay);
int ptlrpc_hr_init(void);
void ptlrpc_hr_fini(void);
typedef int (*timeout_cb_t)(struct timeout_item *, void *);
int ptlrpc_pinger_add_import(struct obd_import *imp);
int ptlrpc_pinger_del_import(struct obd_import *imp);
-int ptlrpc_add_timeout_client(int time, enum timeout_event event,
+int ptlrpc_add_timeout_client(time64_t time, enum timeout_event event,
timeout_cb_t cb, void *data,
struct list_head *obd_list);
int ptlrpc_del_timeout_client(struct list_head *obd_list,
struct timeout_item {
enum timeout_event ti_event;
- cfs_time_t ti_timeout;
+ time64_t ti_timeout;
timeout_cb_t ti_cb;
void *ti_cb_data;
struct list_head ti_obd_list;
* See osc_{reserve|unreserve}_grant for details. */
long cl_reserved_grant;
struct list_head cl_cache_waiters; /* waiting for cache/grant */
- cfs_time_t cl_next_shrink_grant; /* jiffies */
+ time64_t cl_next_shrink_grant; /* seconds */
struct list_head cl_grant_shrink_list; /* Timeout event list */
- int cl_grant_shrink_interval; /* seconds */
+ time64_t cl_grant_shrink_interval; /* seconds */
/* A chunk is an optimal size used by osc_extent to determine
* the extent size. A chunk is max(PAGE_SIZE, OST block size) */
struct obd_export *obd_lwp_export;
/* list of exports in LRU order, for ping evictor, with obd_dev_lock */
struct list_head obd_exports_timed;
- time_t obd_eviction_timer; /* for ping evictor */
+ time64_t obd_eviction_timer; /* for ping evictor */
int obd_max_recoverable_clients;
atomic_t obd_connected_clients;
GOTO(out, rc);
}
- CDEBUG(D_HA, "%s: connection from %s@%s %st%llu exp %p cur %ld last %ld\n",
- target->obd_name, cluuid.uuid, libcfs_nid2str(req->rq_peer.nid),
- target->obd_recovering ? "recovering/" : "", data->ocd_transno,
- export, (long)cfs_time_current_sec(),
- export ? (long)export->exp_last_request_time : 0);
+ CDEBUG(D_HA, "%s: connection from %s@%s %st%llu exp %p cur %lld last %lld\n",
+ target->obd_name, cluuid.uuid, libcfs_nid2str(req->rq_peer.nid),
+ target->obd_recovering ? "recovering/" : "", data->ocd_transno,
+ export, ktime_get_real_seconds(),
+ export ? export->exp_last_request_time : 0);
/* If this is the first time a client connects, reset the recovery
* timer. Discard lightweight connections which might be local. */
INIT_LIST_HEAD(&export->exp_hp_rpcs);
INIT_LIST_HEAD(&export->exp_reg_rpcs);
class_handle_hash(&export->exp_handle, &export_handle_ops);
- export->exp_last_request_time = cfs_time_current_sec();
+ 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);
class_export_get(exp);
CDEBUG(D_HA, "%s: disconnecting export at %s (%p), "
- "last request at %ld\n",
+ "last request at %lld\n",
exp->exp_obd->obd_name, obd_export_nid2str(exp),
exp, exp->exp_last_request_time);
/* release one export reference anyway */
if (obd == NULL)
return 0;
- seq_printf(m, "%d\n",
+ seq_printf(m, "%lld\n",
obd->u.cli.cl_grant_shrink_interval);
return 0;
}
void osc_update_next_shrink(struct client_obd *cli)
{
- cli->cl_next_shrink_grant =
- cfs_time_shift(cli->cl_grant_shrink_interval);
- CDEBUG(D_CACHE, "next time %ld to shrink grant \n",
- cli->cl_next_shrink_grant);
+ cli->cl_next_shrink_grant = ktime_get_seconds() +
+ cli->cl_grant_shrink_interval;
+
+ CDEBUG(D_CACHE, "next time %lld to shrink grant\n",
+ cli->cl_next_shrink_grant);
}
static void __osc_update_grant(struct client_obd *cli, u64 grant)
static int osc_should_shrink_grant(struct client_obd *client)
{
- cfs_time_t time = cfs_time_current();
- cfs_time_t next_shrink = client->cl_next_shrink_grant;
+ time64_t next_shrink = client->cl_next_shrink_grant;
if ((client->cl_import->imp_connect_data.ocd_connect_flags &
OBD_CONNECT_GRANT_SHRINK) == 0)
return 0;
- if (cfs_time_aftereq(time, next_shrink - 5 * CFS_TICK)) {
+ if (ktime_get_seconds() >= next_shrink - 5) {
/* Get the current RPC size directly, instead of going via:
* cli_brw_size(obd->u.cli.cl_import->imp_obd->obd_self_export)
* Keep comment here so that it can be found by searching. */
/**
* Get the smallest timeout in the set; this does NOT set a timeout.
*/
-int ptlrpc_set_next_timeout(struct ptlrpc_request_set *set)
+time64_t ptlrpc_set_next_timeout(struct ptlrpc_request_set *set)
{
struct list_head *tmp;
time64_t now = ktime_get_real_seconds();
struct list_head *tmp;
struct ptlrpc_request *req;
struct l_wait_info lwi;
- int rc, timeout;
- ENTRY;
+ time64_t timeout;
+ int rc;
+ ENTRY;
if (set->set_producer)
(void)ptlrpc_set_producer(set);
/* wait until all complete, interrupted, or an in-flight
* req times out */
- CDEBUG(D_RPCTRACE, "set %p going to sleep for %d seconds\n",
+ CDEBUG(D_RPCTRACE, "set %p going to sleep for %lld seconds\n",
set, timeout);
if ((timeout == 0 && !signal_pending(current)) ||
}
EXPORT_SYMBOL(ptlrpc_deactivate_import);
-static unsigned int
-ptlrpc_inflight_deadline(struct ptlrpc_request *req, time64_t now)
+static time64_t ptlrpc_inflight_deadline(struct ptlrpc_request *req,
+ time64_t now)
{
- long dl;
+ time64_t dl;
if (!(((req->rq_phase == RQ_PHASE_RPC) && !req->rq_waiting) ||
(req->rq_phase == RQ_PHASE_BULK) ||
time64_t now = ktime_get_real_seconds();
struct list_head *tmp, *n;
struct ptlrpc_request *req;
- unsigned int timeout = 0;
+ time64_t timeout = 0;
spin_lock(&imp->imp_lock);
list_for_each_safe(tmp, n, &imp->imp_sending_list) {
struct list_head *tmp, *n;
struct ptlrpc_request *req;
struct l_wait_info lwi;
- unsigned int timeout;
+ time64_t timeout;
int rc;
atomic_inc(&imp->imp_inval_count);
* unlink. We can't do anything before that because there is really
* no guarantee that some rdma transfer is not in progress right now. */
do {
+ long timeout_jiffies;
+
/* Calculate max timeout for waiting on rpcs to error
* out. Use obd_timeout if calculated value is smaller
- * than it. */
+ * than it.
+ */
if (!OBD_FAIL_CHECK(OBD_FAIL_PTLRPC_LONG_REPL_UNLINK)) {
timeout = ptlrpc_inflight_timeout(imp);
timeout += timeout / 3;
timeout = 1;
}
- CDEBUG(D_RPCTRACE,"Sleeping %d sec for inflight to error out\n",
- timeout);
+ CDEBUG(D_RPCTRACE, "Sleeping %llds for inflight to error out\n",
+ timeout);
/* Wait for all requests to error out and call completion
* callbacks. Cap it at obd_timeout -- these should all
- * have been locally cancelled by ptlrpc_abort_inflight. */
- lwi = LWI_TIMEOUT_INTERVAL(
- cfs_timeout_cap(cfs_time_seconds(timeout)),
- (timeout > 1)?cfs_time_seconds(1):cfs_time_seconds(1)/2,
- NULL, NULL);
+ * have been locally cancelled by ptlrpc_abort_inflight.
+ */
+ timeout_jiffies = max_t(long, cfs_time_seconds(timeout), 1);
+ lwi = LWI_TIMEOUT_INTERVAL(timeout_jiffies,
+ (timeout > 1) ? cfs_time_seconds(1) :
+ cfs_time_seconds(1) / 2,
+ NULL, NULL);
rc = l_wait_event(imp->imp_recovery_waitq,
(atomic_read(&imp->imp_inflight) == 0),
&lwi);
int ptlrpc_reconnect_import(struct obd_import *imp)
{
#ifdef ENABLE_PINGER
+ long timeout_jiffies = cfs_time_seconds(obd_timeout);
struct l_wait_info lwi;
- int secs = cfs_time_seconds(obd_timeout);
int rc;
ptlrpc_pinger_force(imp);
CDEBUG(D_HA, "%s: recovery started, waiting %u seconds\n",
- obd2cli_tgt(imp->imp_obd), secs);
+ obd2cli_tgt(imp->imp_obd), obd_timeout);
- lwi = LWI_TIMEOUT(secs, NULL, NULL);
+ lwi = LWI_TIMEOUT(timeout_jiffies, NULL, NULL);
rc = l_wait_event(imp->imp_recovery_waitq,
!ptlrpc_import_in_recovery(imp), &lwi);
CDEBUG(D_HA, "%s: recovery finished s:%s\n", obd2cli_tgt(imp->imp_obd),
RETURN(rc);
}
- if (ptlrpc_import_in_recovery(imp)) {
- struct l_wait_info lwi;
- cfs_duration_t timeout;
+ if (ptlrpc_import_in_recovery(imp)) {
+ struct l_wait_info lwi;
+ long timeout_jiffies;
+ time64_t timeout;
- if (AT_OFF) {
- if (imp->imp_server_timeout)
- timeout = cfs_time_seconds(obd_timeout / 2);
- else
- timeout = cfs_time_seconds(obd_timeout);
- } else {
- int idx = import_at_get_index(imp,
- imp->imp_client->cli_request_portal);
- timeout = cfs_time_seconds(
- at_get(&imp->imp_at.iat_service_estimate[idx]));
+ if (AT_OFF) {
+ if (imp->imp_server_timeout)
+ timeout = obd_timeout >> 1;
+ else
+ timeout = obd_timeout;
+ } else {
+ u32 req_portal;
+ int idx;
+
+ req_portal = imp->imp_client->cli_request_portal;
+ idx = import_at_get_index(imp, req_portal);
+ timeout = at_get(&imp->imp_at.iat_service_estimate[idx]);
}
- lwi = LWI_TIMEOUT_INTR(cfs_timeout_cap(timeout),
+ timeout_jiffies = cfs_time_seconds(timeout);
+ lwi = LWI_TIMEOUT_INTR(max_t(long, timeout_jiffies, 1),
back_to_sleep, LWI_ON_SIGNAL_NOOP, NULL);
rc = l_wait_event(imp->imp_recovery_waitq,
!ptlrpc_import_in_recovery(imp), &lwi);
static void ptlrpc_update_next_ping(struct obd_import *imp, int soon)
{
#ifdef ENABLE_PINGER
- int time = soon ? PING_INTERVAL_SHORT : PING_INTERVAL;
- if (imp->imp_state == LUSTRE_IMP_DISCON) {
- int dtime = max_t(int, CONNECTION_SWITCH_MIN,
- AT_OFF ? 0 :
- at_get(&imp->imp_at.iat_net_latency));
- time = min(time, dtime);
- }
- imp->imp_next_ping = cfs_time_shift(time);
+ time64_t time = soon ? PING_INTERVAL_SHORT : PING_INTERVAL;
+
+ if (imp->imp_state == LUSTRE_IMP_DISCON) {
+ time64_t dtime = max_t(time64_t, CONNECTION_SWITCH_MIN,
+ AT_OFF ? 0 :
+ at_get(&imp->imp_at.iat_net_latency));
+ time = min(time, dtime);
+ }
+ imp->imp_next_ping = ktime_get_seconds() + time;
#endif /* ENABLE_PINGER */
}
void ptlrpc_ping_import_soon(struct obd_import *imp)
{
- imp->imp_next_ping = cfs_time_current();
+ imp->imp_next_ping = ktime_get_seconds();
}
static inline int imp_is_deactive(struct obd_import *imp)
OBD_FAIL_CHECK(OBD_FAIL_PTLRPC_IMP_DEACTIVE));
}
-static inline int ptlrpc_next_reconnect(struct obd_import *imp)
+static inline time64_t ptlrpc_next_reconnect(struct obd_import *imp)
{
- if (imp->imp_server_timeout)
- return cfs_time_shift(obd_timeout / 2);
- else
- return cfs_time_shift(obd_timeout);
+ if (imp->imp_server_timeout)
+ return ktime_get_seconds() + (obd_timeout >> 1);
+ else
+ return ktime_get_seconds() + obd_timeout;
}
-static cfs_duration_t pinger_check_timeout(cfs_time_t time)
+static time64_t pinger_check_timeout(time64_t time)
{
struct timeout_item *item;
- cfs_time_t timeout = PING_INTERVAL;
+ time64_t timeout = PING_INTERVAL;
/* This list is sorted in increasing timeout order */
mutex_lock(&pinger_mutex);
list_for_each_entry(item, &timeout_list, ti_chain) {
- int ti_timeout = item->ti_timeout;
+ time64_t ti_timeout = item->ti_timeout;
+
if (timeout > ti_timeout)
timeout = ti_timeout;
break;
}
mutex_unlock(&pinger_mutex);
- return cfs_time_sub(cfs_time_add(time, cfs_time_seconds(timeout)),
- cfs_time_current());
+ return time + timeout - ktime_get_seconds();
}
-
static bool ir_up;
void ptlrpc_pinger_ir_up(void)
EXPORT_SYMBOL(ptlrpc_pinger_ir_down);
static void ptlrpc_pinger_process_import(struct obd_import *imp,
- unsigned long this_ping)
+ time64_t this_ping)
{
int level;
int force;
imp->imp_force_verify = 0;
- if (cfs_time_aftereq(imp->imp_next_ping - 5 * CFS_TICK, this_ping) &&
- !force) {
+ if (imp->imp_next_ping - 5 >= this_ping && !force) {
spin_unlock(&imp->imp_lock);
return;
}
/* And now, loop forever, pinging as needed. */
while (1) {
- cfs_time_t this_ping = cfs_time_current();
+ time64_t this_ping = ktime_get_seconds();
struct l_wait_info lwi;
- cfs_duration_t time_to_next_wake;
+ time64_t time_to_next_wake;
struct timeout_item *item;
struct list_head *iter;
struct obd_import,
imp_pinger_chain);
- ptlrpc_pinger_process_import(imp, this_ping);
- /* obd_timeout might have changed */
- if (imp->imp_pingable && imp->imp_next_ping &&
- cfs_time_after(imp->imp_next_ping,
- cfs_time_add(this_ping,
- cfs_time_seconds(PING_INTERVAL))))
- ptlrpc_update_next_ping(imp, 0);
- }
+ ptlrpc_pinger_process_import(imp, this_ping);
+ /* obd_timeout might have changed */
+ if (imp->imp_pingable && imp->imp_next_ping &&
+ imp->imp_next_ping > this_ping + PING_INTERVAL)
+ ptlrpc_update_next_ping(imp, 0);
+ }
mutex_unlock(&pinger_mutex);
- /* update memory usage info */
- obd_update_maxusage();
+ /* update memory usage info */
+ obd_update_maxusage();
/* Wait until the next ping time, or until we're stopped. */
time_to_next_wake = pinger_check_timeout(this_ping);
next ping time to next_ping + .01 sec, which means
we will SKIP the next ping at next_ping, and the
ping will get sent 2 timeouts from now! Beware. */
- CDEBUG(D_INFO, "next wakeup in "CFS_DURATION_T" (%ld)\n",
- time_to_next_wake,
- cfs_time_add(this_ping,cfs_time_seconds(PING_INTERVAL)));
+ CDEBUG(D_INFO, "next wakeup in %lld (%lld)\n",
+ time_to_next_wake, this_ping + PING_INTERVAL);
if (time_to_next_wake > 0) {
- lwi = LWI_TIMEOUT(max_t(cfs_duration_t,
- time_to_next_wake,
- cfs_time_seconds(1)),
+ time64_t time_max = max(time_to_next_wake, 1LL);
+
+ lwi = LWI_TIMEOUT(cfs_time_seconds(time_max),
NULL, NULL);
l_wait_event(thread->t_ctl_waitq,
thread_is_stopping(thread) ||
* Register a timeout callback to the pinger list, and the callback will
* be called when timeout happens.
*/
-static struct timeout_item *ptlrpc_new_timeout(int time,
+static struct timeout_item *ptlrpc_new_timeout(time64_t time,
enum timeout_event event,
timeout_cb_t cb, void *data)
{
* Note: the timeout list is an sorted list with increased timeout value.
*/
static struct timeout_item*
-ptlrpc_pinger_register_timeout(int time, enum timeout_event event,
+ptlrpc_pinger_register_timeout(time64_t time, enum timeout_event event,
timeout_cb_t cb, void *data)
{
struct timeout_item *item, *tmp;
/* Add a client_obd to the timeout event list, when timeout(@time)
* happens, the callback(@cb) will be called.
*/
-int ptlrpc_add_timeout_client(int time, enum timeout_event event,
+int ptlrpc_add_timeout_client(time64_t time, enum timeout_event event,
timeout_cb_t cb, void *data,
struct list_head *obd_list)
{
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;
- ENTRY;
+ struct obd_device *obd;
+ struct obd_export *exp;
+ struct l_wait_info lwi = { 0 };
+ time64_t expire_time;
+ ENTRY;
unshare_fs_struct();
CDEBUG(D_HA, "Starting Ping Evictor\n");
obd_evict_list);
spin_unlock(&pet_lock);
- expire_time = cfs_time_current_sec() - 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",
+ CDEBUG(D_HA, "evicting all exports of obd %s older than %lld\n",
obd->obd_name, expire_time);
/* Exports can't be deleted out of the list while we hold
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"
+ " (at %s) in %lld seconds. I think"
" it's dead, and I am evicting"
- " it. exp %p, cur %ld expire %ld"
- " last %ld\n",
+ " it. exp %p, cur %lld expire %lld"
+ " last %lld\n",
obd->obd_name,
obd_uuid2str(&exp->exp_client_uuid),
obd_export_nid2str(exp),
- (long)(cfs_time_current_sec() -
- exp->exp_last_request_time),
- exp, (long)cfs_time_current_sec(),
- (long)expire_time,
- (long)exp->exp_last_request_time);
- CDEBUG(D_HA, "Last request was at %ld\n",
+ ktime_get_real_seconds() -
+ exp->exp_last_request_time,
+ exp, ktime_get_real_seconds(),
+ expire_time,
+ exp->exp_last_request_time);
+ CDEBUG(D_HA, "Last request was at %lld\n",
exp->exp_last_request_time);
class_fail_export(exp);
class_export_put(exp);
void ptlrpc_set_add_new_req(struct ptlrpcd_ctl *pc,
struct ptlrpc_request *req);
int ptlrpc_expired_set(void *data);
-int ptlrpc_set_next_timeout(struct ptlrpc_request_set *);
+time64_t ptlrpc_set_next_timeout(struct ptlrpc_request_set *);
void ptlrpc_resend_req(struct ptlrpc_request *request);
void ptlrpc_set_bulk_mbits(struct ptlrpc_request *req);
void ptlrpc_assign_next_xid_nolock(struct ptlrpc_request *req);
*/
do {
struct l_wait_info lwi;
- int timeout;
+ time64_t timeout;
timeout = ptlrpc_set_next_timeout(set);
lwi = LWI_TIMEOUT(cfs_time_seconds(timeout ? timeout : 1),
if (!async) {
struct l_wait_info lwi;
- int secs = cfs_time_seconds(obd_timeout);
+ long secs = cfs_time_seconds(obd_timeout);
- CDEBUG(D_HA, "%s: recovery started, waiting %u seconds\n",
+ CDEBUG(D_HA, "%s: recovery started, waiting %lu seconds\n",
obd2cli_tgt(imp->imp_obd), secs);
lwi = LWI_TIMEOUT(secs, NULL, NULL);
* This function is only called when some export receives a message (i.e.,
* the network is up.)
*/
-void ptlrpc_update_export_timer(struct obd_export *exp, long extra_delay)
+void ptlrpc_update_export_timer(struct obd_export *exp, time64_t extra_delay)
{
- struct obd_export *oldest_exp;
- time_t oldest_time, new_time;
+ struct obd_export *oldest_exp;
+ time64_t oldest_time, new_time;
ENTRY;
will make it to the top of the list. */
/* Do not pay attention on 1sec or smaller renewals. */
- new_time = cfs_time_current_sec() + extra_delay;
+ new_time = ktime_get_real_seconds() + extra_delay;
if (exp->exp_last_request_time + 1 /*second */ >= new_time)
RETURN_EXIT;
return;
}
- /* 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 (cfs_time_current_sec() > (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
- * other PING_INTERVAL (see note in ptlrpc_pinger_main),
- * we better wait for 3. */
- exp->exp_obd->obd_eviction_timer =
- cfs_time_current_sec() + 3 * PING_INTERVAL;
- CDEBUG(D_HA, "%s: Think about evicting %s from %ld\n",
- exp->exp_obd->obd_name,
- obd_export_nid2str(oldest_exp), oldest_time);
- }
- } else {
- if (cfs_time_current_sec() >
- (exp->exp_obd->obd_eviction_timer + extra_delay)) {
- /* The evictor won't evict anyone who we've heard from
- * recently, so we don't have to check before we start
- * it. */
- if (!ping_evictor_wake(exp))
- exp->exp_obd->obd_eviction_timer = 0;
- }
- }
+ /* 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 (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
+ * other PING_INTERVAL (see note in ptlrpc_pinger_main),
+ * 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 %lld\n",
+ exp->exp_obd->obd_name,
+ obd_export_nid2str(oldest_exp), oldest_time);
+ }
+ } else {
+ if (ktime_get_real_seconds() >
+ (exp->exp_obd->obd_eviction_timer + extra_delay)) {
+ /* The evictor won't evict anyone who we've heard from
+ * recently, so we don't have to check before we start
+ * it.
+ */
+ if (!ping_evictor_wake(exp))
+ exp->exp_obd->obd_eviction_timer = 0;
+ }
+ }
- EXIT;
+ EXIT;
}
/**
if (unlikely(ptlrpc_check_req(request)))
goto put_conn;
ptlrpc_update_export_timer(request->rq_export,
- timediff_usecs >> 19);
+ timediff_usecs / (USEC_PER_SEC / 2));
}
/* Discard requests queued for longer than the deadline.