From 3f65f631c74ddf648ae8522f887da9e4edbf4c7d Mon Sep 17 00:00:00 2001 From: Qian Yingjin Date: Fri, 2 Nov 2018 16:39:37 +0800 Subject: [PATCH] LU-11599 ldlm: printing negative time on logs for recovery At Lustre recovery, it prints a negative time which is wrong. "Denying connection for new client ..., waiting for 33 known clients (32 recovered, 0 in progress, and 0 evicted) to recover in -1:-11" This patch adds a judgement whether the recovery deadline has already passed. Signed-off-by: Qian Yingjin Change-Id: Id832d8dbad694d241cc08156179afedf86c8aac2 Reviewed-on: https://review.whamcloud.com/33554 Tested-by: Jenkins Reviewed-by: James Simmons Tested-by: Maloo Reviewed-by: Andreas Dilger --- lustre/ldlm/ldlm_lib.c | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/lustre/ldlm/ldlm_lib.c b/lustre/ldlm/ldlm_lib.c index de66aa3..9b5c425 100644 --- a/lustre/ldlm/ldlm_lib.c +++ b/lustre/ldlm/ldlm_lib.c @@ -1251,7 +1251,9 @@ no_export: /* allow "new" MDT to be connected during recovery, since we * need retrieve recovery update records from it */ if (target->obd_recovering && !lw_client && !mds_mds_conn) { + time64_t now; time64_t t; + char *msg; int c; /* connected */ int i; /* in progress */ int k; /* known */ @@ -1263,14 +1265,22 @@ no_export: s = target->obd_stale_clients; t = jiffies_to_msecs(target->obd_recovery_timer.expires); t /= MSEC_PER_SEC; - t -= ktime_get_seconds(); + now = ktime_get_seconds(); + if (now > t) { + t = now - t; + msg = "already passed deadline"; + } else { + t -= now; + msg = "to recover in"; + } + LCONSOLE_WARN("%s: Denying connection for new client %s" "(at %s), waiting for %d known clients " "(%d recovered, %d in progress, and %d " - "evicted) to recover in %lld:%.02lld\n", + "evicted) %s %lld:%.02lld\n", target->obd_name, cluuid.uuid, libcfs_nid2str(req->rq_peer.nid), k, - c - i, i, s, t / 60, t % 60); + c - i, i, s, msg, t / 60, t % 60); rc = -EBUSY; } else { dont_check_exports: -- 1.8.3.1