summary |
shortlog |
log |
commit | commitdiff |
tree
raw |
patch |
inline | side by side (from parent 1:
01261e7)
instead of real one. also use absolute values for timer.
One of the reasons for the move from jiffies based timer
to a hrtimer timer was to avoid the issue of time drift.
It was discovered due to test failures with recovery on
VMs that the high resolution wall clock can drift as well.
Moving to the monotonic clock for the hrtimer avoids this
drift completely and it is safe to use since the recovery
timestamp is not shared between nodes.
Signed-off-by: Alex Zhuravlev <bzzz@whamcloud.com>
Change-Id: I8b75121934c229dec8df7be0a4e69c1cda940d3f
Reviewed-on: https://review.whamcloud.com/36274
Tested-by: jenkins <devops@whamcloud.com>
Reviewed-by: James Simmons <jsimmons@infradead.org>
Tested-by: Maloo <maloo@whamcloud.com>
Reviewed-by: Andreas Dilger <adilger@whamcloud.com>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
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,
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, ktime_get_seconds(),
export ? export->exp_last_request_time : 0);
/*
export ? export->exp_last_request_time : 0);
/*
/* Only log a recovery message when recovery has occurred. */
if (obd->obd_recovery_start) {
/* Only log a recovery message when recovery has occurred. */
if (obd->obd_recovery_start) {
- time64_t now = ktime_get_real_seconds();
+ time64_t now = ktime_get_seconds();
time64_t elapsed_time;
elapsed_time = max_t(time64_t, now - obd->obd_recovery_start,
time64_t elapsed_time;
elapsed_time = max_t(time64_t, now - obd->obd_recovery_start,
}
spin_unlock(&obd->obd_recovery_task_lock);
}
spin_unlock(&obd->obd_recovery_task_lock);
- obd->obd_recovery_end = ktime_get_real_seconds();
+ obd->obd_recovery_end = ktime_get_seconds();
/* When recovery finished, cleanup orphans on MDS and OST. */
if (obd->obd_type && OBP(obd, postrecov)) {
/* When recovery finished, cleanup orphans on MDS and OST. */
if (obd->obd_type && OBP(obd, postrecov)) {
- delay = ktime_set(obd->obd_recovery_timeout, 0);
- hrtimer_start(&obd->obd_recovery_timer, delay, HRTIMER_MODE_REL);
- obd->obd_recovery_start = ktime_get_real_seconds();
+ obd->obd_recovery_start = ktime_get_seconds();
+ delay = ktime_set(obd->obd_recovery_start +
+ obd->obd_recovery_timeout, 0);
+ hrtimer_start(&obd->obd_recovery_timer, delay, HRTIMER_MODE_ABS);
spin_unlock(&obd->obd_dev_lock);
LCONSOLE_WARN("%s: Will be in recovery for at least %lu:%02lu, or until %d client%s reconnect%s\n",
spin_unlock(&obd->obd_dev_lock);
LCONSOLE_WARN("%s: Will be in recovery for at least %lu:%02lu, or until %d client%s reconnect%s\n",
obd->obd_name, timeout, extend);
if (obd->obd_recovery_timeout < timeout) {
obd->obd_name, timeout, extend);
if (obd->obd_recovery_timeout < timeout) {
- ktime_t now = ktime_get_real();
- ktime_t end;
obd->obd_recovery_timeout = timeout;
end = ktime_set(obd->obd_recovery_start + timeout, 0);
obd->obd_recovery_timeout = timeout;
end = ktime_set(obd->obd_recovery_start + timeout, 0);
+ now = ktime_set(ktime_get_seconds(), 0);
left_ns = ktime_sub(end, now);
left_ns = ktime_sub(end, now);
- hrtimer_forward_now(&obd->obd_recovery_timer, left_ns);
- left = ktime_divns(left_ns, NSEC_PER_MSEC);
+ hrtimer_start(&obd->obd_recovery_timer, end, HRTIMER_MODE_ABS);
+ left = ktime_divns(left_ns, NSEC_PER_SEC);
}
spin_unlock(&obd->obd_dev_lock);
}
spin_unlock(&obd->obd_dev_lock);
- if (obd->obd_recovery_start != 0 && ktime_get_real_seconds() >=
+ if (obd->obd_recovery_start != 0 && ktime_get_seconds() >=
(obd->obd_recovery_start + obd->obd_recovery_time_hard)) {
__u64 next_update_transno = 0;
(obd->obd_recovery_start + obd->obd_recovery_time_hard)) {
__u64 next_update_transno = 0;
return 1;
} else if (obd->obd_recovery_expired) {
obd->obd_recovery_expired = 0;
return 1;
} else if (obd->obd_recovery_expired) {
obd->obd_recovery_expired = 0;
/** If some clients died being recovered, evict them */
LCONSOLE_WARN("%s: recovery is timed out, evict stale exports\n",
obd->obd_name);
/** If some clients died being recovered, evict them */
LCONSOLE_WARN("%s: recovery is timed out, evict stale exports\n",
obd->obd_name);
obd->obd_recovery_start = 0;
obd->obd_recovery_end = 0;
obd->obd_recovery_start = 0;
obd->obd_recovery_end = 0;
- hrtimer_init(&obd->obd_recovery_timer, CLOCK_REALTIME,
- HRTIMER_MODE_REL);
+ hrtimer_init(&obd->obd_recovery_timer, CLOCK_MONOTONIC,
+ HRTIMER_MODE_ABS);
obd->obd_recovery_timer.function = &target_recovery_expired;
target_start_recovery_thread(lut, handler);
}
obd->obd_recovery_timer.function = &target_recovery_expired;
target_start_recovery_thread(lut, handler);
}
int target_bulk_io(struct obd_export *exp, struct ptlrpc_bulk_desc *desc)
{
struct ptlrpc_request *req = desc->bd_req;
int target_bulk_io(struct obd_export *exp, struct ptlrpc_bulk_desc *desc)
{
struct ptlrpc_request *req = desc->bd_req;
- time64_t start = ktime_get_real_seconds();
+ time64_t start = ktime_get_seconds();
time64_t deadline;
struct l_wait_info lwi;
int rc = 0;
time64_t deadline;
struct l_wait_info lwi;
int rc = 0;
deadline = req->rq_deadline;
do {
deadline = req->rq_deadline;
do {
- time64_t timeoutl = deadline - ktime_get_real_seconds();
+ time64_t timeoutl = deadline - ktime_get_seconds();
long timeout_jiffies = timeoutl <= 0 ?
1 : cfs_time_seconds(timeoutl);
time64_t rq_deadline;
long timeout_jiffies = timeoutl <= 0 ?
1 : cfs_time_seconds(timeoutl);
time64_t rq_deadline;
if (deadline > rq_deadline)
deadline = rq_deadline;
} while (rc == -ETIMEDOUT &&
if (deadline > rq_deadline)
deadline = rq_deadline;
} while (rc == -ETIMEDOUT &&
- deadline > ktime_get_real_seconds());
+ deadline > ktime_get_seconds());
if (rc == -ETIMEDOUT) {
DEBUG_REQ(D_ERROR, req, "timeout on bulk %s after %lld%+llds",
if (rc == -ETIMEDOUT) {
DEBUG_REQ(D_ERROR, req, "timeout on bulk %s after %lld%+llds",