Whamcloud - gitweb
LU-1095 debug: conditionally print recovery status
authorMinh Diep <mdiep@whamcloud.com>
Wed, 19 Sep 2012 17:50:11 +0000 (10:50 -0700)
committerOleg Drokin <green@whamcloud.com>
Wed, 3 Oct 2012 00:14:17 +0000 (20:14 -0400)
Avoid printing non-sense messages like this when the recovery
code hasn't run. For example, this can occur when your starting
a new target for the first time.

  Lustre: lustre-OST0001: Recovery over after 22277843:04,
  of 0 clients 0 recovered and 0 were evicted.

Signed-off-by: Minh Diep <mdiep@whamcloud.com>
Change-Id: Ib4bd8783c0c17aa15052fc9b9cf78e18274b2783
Reviewed-on: http://review.whamcloud.com/4043
Tested-by: Hudson
Tested-by: Maloo <whamcloud.maloo@gmail.com>
Reviewed-by: Andreas Dilger <adilger@whamcloud.com>
Reviewed-by: Keith Mannthey <keith.mannthey@intel.com>
lustre/ldlm/ldlm_lib.c

index 288003c..54780a7 100644 (file)
@@ -1376,17 +1376,20 @@ static void target_exp_dequeue_req_replay(struct ptlrpc_request *req)
 #ifdef __KERNEL__
 static void target_finish_recovery(struct obd_device *obd)
 {
-        time_t elapsed_time = max_t(time_t, 1, cfs_time_current_sec() -
-                                    obd->obd_recovery_start);
         ENTRY;
 
-        LCONSOLE_INFO("%s: Recovery over after %d:%.02d, of %d clients "
-                      "%d recovered and %d %s evicted.\n", obd->obd_name,
-                      (int)elapsed_time / 60, (int)elapsed_time % 60,
-                      obd->obd_max_recoverable_clients,
-                      cfs_atomic_read(&obd->obd_connected_clients),
-                      obd->obd_stale_clients,
-                      obd->obd_stale_clients == 1 ? "was" : "were");
+       /* only log a recovery message when recovery has occurred */
+       if (obd->obd_recovery_start) {
+               time_t elapsed_time = max_t(time_t, 1, cfs_time_current_sec() -
+                                       obd->obd_recovery_start);
+               LCONSOLE_INFO("%s: Recovery over after %d:%.02d, of %d clients "
+                       "%d recovered and %d %s evicted.\n", obd->obd_name,
+                       (int)elapsed_time / 60, (int)elapsed_time % 60,
+                       obd->obd_max_recoverable_clients,
+                       cfs_atomic_read(&obd->obd_connected_clients),
+                       obd->obd_stale_clients,
+                       obd->obd_stale_clients == 1 ? "was" : "were");
+       }
 
         ldlm_reprocess_all_ns(obd->obd_namespace);
         cfs_spin_lock(&obd->obd_recovery_task_lock);