mirror of https://gitee.com/openkylin/linux.git
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: Arnd Bergmann <arnd@arndb.de> Signed-off-by: Oleg Drokin <green@linuxhacker.ru> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
parent
86655400c6
commit
bf6d21539d
|
@ -749,7 +749,7 @@ struct ldlm_lock {
|
|||
* Seconds. It will be updated if there is any activity related to
|
||||
* 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.
|
||||
|
|
|
@ -1564,7 +1564,7 @@ ldlm_error_t ldlm_lock_enqueue(struct ldlm_namespace *ns,
|
|||
ldlm_error_t rc = ELDLM_OK;
|
||||
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 */
|
||||
if ((*flags & (LDLM_FL_HAS_INTENT|LDLM_FL_REPLAY)) == LDLM_FL_HAS_INTENT
|
||||
&& !local && ns->ns_policy) {
|
||||
|
|
|
@ -97,15 +97,14 @@ int ldlm_expired_completion_wait(void *data)
|
|||
if (lock->l_conn_export == NULL) {
|
||||
static unsigned long next_dump, last_dump;
|
||||
|
||||
LCONSOLE_WARN("lock timed out (enqueued at "CFS_TIME_T", "
|
||||
CFS_DURATION_T"s ago)\n",
|
||||
lock->l_last_activity,
|
||||
cfs_time_sub(get_seconds(),
|
||||
lock->l_last_activity));
|
||||
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",
|
||||
lock->l_last_activity,
|
||||
cfs_time_sub(get_seconds(),
|
||||
lock->l_last_activity));
|
||||
LCONSOLE_WARN("lock timed out (enqueued at %lld, %llds ago)\n",
|
||||
(s64)lock->l_last_activity,
|
||||
(s64)(ktime_get_real_seconds() -
|
||||
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",
|
||||
(s64)lock->l_last_activity,
|
||||
(s64)(ktime_get_real_seconds() -
|
||||
lock->l_last_activity));
|
||||
if (cfs_time_after(cfs_time_current(), next_dump)) {
|
||||
last_dump = next_dump;
|
||||
next_dump = cfs_time_shift(300);
|
||||
|
@ -120,11 +119,10 @@ int ldlm_expired_completion_wait(void *data)
|
|||
obd = lock->l_conn_export->exp_obd;
|
||||
imp = obd->u.cli.cl_import;
|
||||
ptlrpc_fail_import(imp, lwd->lwd_conn_cnt);
|
||||
LDLM_ERROR(lock, "lock timed out (enqueued at "CFS_TIME_T", "
|
||||
CFS_DURATION_T"s ago), entering recovery for %s@%s",
|
||||
lock->l_last_activity,
|
||||
cfs_time_sub(get_seconds(), lock->l_last_activity),
|
||||
obd2cli_tgt(obd), imp->imp_connection->c_remote_uuid.uuid);
|
||||
LDLM_ERROR(lock, "lock timed out (enqueued at %lld, %llds ago), entering recovery for %s@%s",
|
||||
(s64)lock->l_last_activity,
|
||||
(s64)(ktime_get_real_seconds() - lock->l_last_activity),
|
||||
obd2cli_tgt(obd), imp->imp_connection->c_remote_uuid.uuid);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -159,10 +157,9 @@ static int ldlm_completion_tail(struct ldlm_lock *lock)
|
|||
LDLM_DEBUG(lock, "client-side enqueue: destroyed");
|
||||
result = -EIO;
|
||||
} else {
|
||||
delay = cfs_time_sub(get_seconds(),
|
||||
lock->l_last_activity);
|
||||
LDLM_DEBUG(lock, "client-side enqueue: granted after "
|
||||
CFS_DURATION_T"s", delay);
|
||||
delay = ktime_get_real_seconds() - lock->l_last_activity;
|
||||
LDLM_DEBUG(lock, "client-side enqueue: granted after %lds",
|
||||
delay);
|
||||
|
||||
/* Update our time estimate */
|
||||
at_measured(ldlm_lock_to_ns_at(lock),
|
||||
|
|
Loading…
Reference in New Issue