Commit bf6d2153 authored by Arnd Bergmann's avatar Arnd Bergmann Committed by Greg Kroah-Hartman

staging/lustre: use time64_t for l_last_activity

The l_last_activity struct member is used to keep track lock hold
times, and it is printed for debugging purposes. For the elapsed
time, we can use 'long' here, but it's better to use time64_t
for storing the real time to avoid an overflow in 2038.
Signed-off-by: default avatarArnd Bergmann <arnd@arndb.de>
Signed-off-by: default avatarOleg Drokin <green@linuxhacker.ru>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 86655400
...@@ -749,7 +749,7 @@ struct ldlm_lock { ...@@ -749,7 +749,7 @@ struct ldlm_lock {
* Seconds. It will be updated if there is any activity related to * Seconds. It will be updated if there is any activity related to
* the lock, e.g. enqueue the lock or send blocking AST. * the lock, e.g. enqueue the lock or send blocking AST.
*/ */
unsigned long l_last_activity; time64_t l_last_activity;
/** /**
* Time last used by e.g. being matched by lock match. * Time last used by e.g. being matched by lock match.
......
...@@ -1564,7 +1564,7 @@ ldlm_error_t ldlm_lock_enqueue(struct ldlm_namespace *ns, ...@@ -1564,7 +1564,7 @@ ldlm_error_t ldlm_lock_enqueue(struct ldlm_namespace *ns,
ldlm_error_t rc = ELDLM_OK; ldlm_error_t rc = ELDLM_OK;
struct ldlm_interval *node = NULL; struct ldlm_interval *node = NULL;
lock->l_last_activity = get_seconds(); lock->l_last_activity = ktime_get_real_seconds();
/* policies are not executed on the client or during replay */ /* policies are not executed on the client or during replay */
if ((*flags & (LDLM_FL_HAS_INTENT|LDLM_FL_REPLAY)) == LDLM_FL_HAS_INTENT if ((*flags & (LDLM_FL_HAS_INTENT|LDLM_FL_REPLAY)) == LDLM_FL_HAS_INTENT
&& !local && ns->ns_policy) { && !local && ns->ns_policy) {
......
...@@ -97,15 +97,14 @@ int ldlm_expired_completion_wait(void *data) ...@@ -97,15 +97,14 @@ int ldlm_expired_completion_wait(void *data)
if (lock->l_conn_export == NULL) { if (lock->l_conn_export == NULL) {
static unsigned long next_dump, last_dump; static unsigned long next_dump, last_dump;
LCONSOLE_WARN("lock timed out (enqueued at "CFS_TIME_T", " LCONSOLE_WARN("lock timed out (enqueued at %lld, %llds ago)\n",
CFS_DURATION_T"s ago)\n", (s64)lock->l_last_activity,
lock->l_last_activity, (s64)(ktime_get_real_seconds() -
cfs_time_sub(get_seconds(), lock->l_last_activity));
lock->l_last_activity)); LDLM_DEBUG(lock, "lock timed out (enqueued at %lld, %llds ago); not entering recovery in server code, just going back to sleep",
LDLM_DEBUG(lock, "lock timed out (enqueued at " CFS_TIME_T ", " CFS_DURATION_T "s ago); not entering recovery in server code, just going back to sleep", (s64)lock->l_last_activity,
lock->l_last_activity, (s64)(ktime_get_real_seconds() -
cfs_time_sub(get_seconds(), lock->l_last_activity));
lock->l_last_activity));
if (cfs_time_after(cfs_time_current(), next_dump)) { if (cfs_time_after(cfs_time_current(), next_dump)) {
last_dump = next_dump; last_dump = next_dump;
next_dump = cfs_time_shift(300); next_dump = cfs_time_shift(300);
...@@ -120,11 +119,10 @@ int ldlm_expired_completion_wait(void *data) ...@@ -120,11 +119,10 @@ int ldlm_expired_completion_wait(void *data)
obd = lock->l_conn_export->exp_obd; obd = lock->l_conn_export->exp_obd;
imp = obd->u.cli.cl_import; imp = obd->u.cli.cl_import;
ptlrpc_fail_import(imp, lwd->lwd_conn_cnt); ptlrpc_fail_import(imp, lwd->lwd_conn_cnt);
LDLM_ERROR(lock, "lock timed out (enqueued at "CFS_TIME_T", " LDLM_ERROR(lock, "lock timed out (enqueued at %lld, %llds ago), entering recovery for %s@%s",
CFS_DURATION_T"s ago), entering recovery for %s@%s", (s64)lock->l_last_activity,
lock->l_last_activity, (s64)(ktime_get_real_seconds() - lock->l_last_activity),
cfs_time_sub(get_seconds(), lock->l_last_activity), obd2cli_tgt(obd), imp->imp_connection->c_remote_uuid.uuid);
obd2cli_tgt(obd), imp->imp_connection->c_remote_uuid.uuid);
return 0; return 0;
} }
...@@ -159,10 +157,9 @@ static int ldlm_completion_tail(struct ldlm_lock *lock) ...@@ -159,10 +157,9 @@ static int ldlm_completion_tail(struct ldlm_lock *lock)
LDLM_DEBUG(lock, "client-side enqueue: destroyed"); LDLM_DEBUG(lock, "client-side enqueue: destroyed");
result = -EIO; result = -EIO;
} else { } else {
delay = cfs_time_sub(get_seconds(), delay = ktime_get_real_seconds() - lock->l_last_activity;
lock->l_last_activity); LDLM_DEBUG(lock, "client-side enqueue: granted after %lds",
LDLM_DEBUG(lock, "client-side enqueue: granted after " delay);
CFS_DURATION_T"s", delay);
/* Update our time estimate */ /* Update our time estimate */
at_measured(ldlm_lock_to_ns_at(lock), at_measured(ldlm_lock_to_ns_at(lock),
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment