Whamcloud - gitweb
LU-11599 ldlm: printing negative time on logs for recovery 54/33554/2
authorQian Yingjin <qian@ddn.com>
Fri, 2 Nov 2018 08:39:37 +0000 (16:39 +0800)
committerOleg Drokin <green@whamcloud.com>
Sat, 10 Nov 2018 05:23:32 +0000 (05:23 +0000)
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 <qian@ddn.com>
Change-Id: Id832d8dbad694d241cc08156179afedf86c8aac2
Reviewed-on: https://review.whamcloud.com/33554
Tested-by: Jenkins
Reviewed-by: James Simmons <uja.ornl@yahoo.com>
Tested-by: Maloo <hpdd-maloo@intel.com>
Reviewed-by: Andreas Dilger <adilger@whamcloud.com>
lustre/ldlm/ldlm_lib.c

index de66aa3..9b5c425 100644 (file)
@@ -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) {
                /* 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;
                        time64_t t;
+                       char *msg;
                        int c; /* connected */
                        int i; /* in progress */
                        int k; /* known */
                        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;
                        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 "
                        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,
                                      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:
                        rc = -EBUSY;
                } else {
 dont_check_exports: