Whamcloud - gitweb
LU-7903 mdt: dump exports information on console 99/21599/6
authorNiu Yawei <yawei.niu@intel.com>
Fri, 29 Jul 2016 06:54:16 +0000 (02:54 -0400)
committerOleg Drokin <oleg.drokin@intel.com>
Thu, 8 Sep 2016 02:05:42 +0000 (02:05 +0000)
To avoid being truncated in debug log, obd_exports_barrier() should
dump the exports information on console along with the "Is it stuck?"
warning message.

Test-Parameters: testlist=recovery-small,recovery-small,recovery-small
Signed-off-by: Niu Yawei <yawei.niu@intel.com>
Change-Id: I9dbaa7ed1d590db89ad6f42b66ec883dfb8b7ce1
Reviewed-on: http://review.whamcloud.com/21599
Tested-by: Jenkins
Tested-by: Maloo <hpdd-maloo@intel.com>
Reviewed-by: Fan Yong <fan.yong@intel.com>
Reviewed-by: Lai Siyao <lai.siyao@intel.com>
Reviewed-by: Oleg Drokin <oleg.drokin@intel.com>
lustre/include/obd_class.h
lustre/obdclass/genops.c
lustre/obdclass/obd_config.c

index 28a174a..d6127a7 100644 (file)
@@ -147,7 +147,7 @@ struct obd_device *class_incref(struct obd_device *obd,
                                 const char *scope, const void *source);
 void class_decref(struct obd_device *obd,
                   const char *scope, const void *source);
                                 const char *scope, const void *source);
 void class_decref(struct obd_device *obd,
                   const char *scope, const void *source);
-void dump_exports(struct obd_device *obd, int locks);
+void dump_exports(struct obd_device *obd, int locks, int debug_level);
 int class_config_llog_handler(const struct lu_env *env,
                              struct llog_handle *handle,
                              struct llog_rec_hdr *rec, void *data);
 int class_config_llog_handler(const struct lu_env *env,
                              struct llog_handle *handle,
                              struct llog_rec_hdr *rec, void *data);
index 004e02b..e0e2b26 100644 (file)
@@ -62,7 +62,7 @@ static void obd_zombie_impexp_notify(void);
 static void obd_zombie_export_add(struct obd_export *exp);
 static void obd_zombie_import_add(struct obd_import *imp);
 static void print_export_data(struct obd_export *exp,
 static void obd_zombie_export_add(struct obd_export *exp);
 static void obd_zombie_import_add(struct obd_import *imp);
 static void print_export_data(struct obd_export *exp,
-                              const char *status, int locks);
+                              const char *status, int locks, int debug_level);
 
 struct list_head obd_stale_exports;
 spinlock_t       obd_stale_export_lock;
 
 struct list_head obd_stale_exports;
 spinlock_t       obd_stale_export_lock;
@@ -1380,7 +1380,7 @@ void class_disconnect_stale_exports(struct obd_device *obd,
                        obd->obd_name, exp->exp_client_uuid.uuid,
                        exp->exp_connection == NULL ? "<unknown>" :
                        libcfs_nid2str(exp->exp_connection->c_peer.nid));
                        obd->obd_name, exp->exp_client_uuid.uuid,
                        exp->exp_connection == NULL ? "<unknown>" :
                        libcfs_nid2str(exp->exp_connection->c_peer.nid));
-                print_export_data(exp, "EVICTING", 0);
+                print_export_data(exp, "EVICTING", 0, D_HA);
         }
        spin_unlock(&obd->obd_dev_lock);
 
         }
        spin_unlock(&obd->obd_dev_lock);
 
@@ -1535,7 +1535,7 @@ EXPORT_SYMBOL(class_export_dump_hook);
 #endif
 
 static void print_export_data(struct obd_export *exp, const char *status,
 #endif
 
 static void print_export_data(struct obd_export *exp, const char *status,
-                             int locks)
+                             int locks, int debug_level)
 {
        struct ptlrpc_reply_state *rs;
        struct ptlrpc_reply_state *first_reply = NULL;
 {
        struct ptlrpc_reply_state *rs;
        struct ptlrpc_reply_state *first_reply = NULL;
@@ -1550,36 +1550,37 @@ static void print_export_data(struct obd_export *exp, const char *status,
        }
        spin_unlock(&exp->exp_lock);
 
        }
        spin_unlock(&exp->exp_lock);
 
-       CDEBUG(D_HA, "%s: %s %p %s %s %d (%d %d %d) %d %d %d %d: %p %s %llu\n",
-               exp->exp_obd->obd_name, status, exp, exp->exp_client_uuid.uuid,
+       CDEBUG(debug_level, "%s: %s %p %s %s %d (%d %d %d) %d %d %d %d: "
+              "%p %s %llu stale:%d\n",
+              exp->exp_obd->obd_name, status, exp, exp->exp_client_uuid.uuid,
               obd_export_nid2str(exp), atomic_read(&exp->exp_refcount),
               atomic_read(&exp->exp_rpc_count),
               atomic_read(&exp->exp_cb_count),
               atomic_read(&exp->exp_locks_count),
               obd_export_nid2str(exp), atomic_read(&exp->exp_refcount),
               atomic_read(&exp->exp_rpc_count),
               atomic_read(&exp->exp_cb_count),
               atomic_read(&exp->exp_locks_count),
-               exp->exp_disconnected, exp->exp_delayed, exp->exp_failed,
-               nreplies, first_reply, nreplies > 3 ? "..." : "",
-               exp->exp_last_committed);
+              exp->exp_disconnected, exp->exp_delayed, exp->exp_failed,
+              nreplies, first_reply, nreplies > 3 ? "..." : "",
+              exp->exp_last_committed, !list_empty(&exp->exp_stale_list));
 #if LUSTRE_TRACKS_LOCK_EXP_REFS
 #if LUSTRE_TRACKS_LOCK_EXP_REFS
-        if (locks && class_export_dump_hook != NULL)
-                class_export_dump_hook(exp);
+       if (locks && class_export_dump_hook != NULL)
+               class_export_dump_hook(exp);
 #endif
 }
 
 #endif
 }
 
-void dump_exports(struct obd_device *obd, int locks)
+void dump_exports(struct obd_device *obd, int locks, int debug_level)
 {
         struct obd_export *exp;
 
        spin_lock(&obd->obd_dev_lock);
        list_for_each_entry(exp, &obd->obd_exports, exp_obd_chain)
 {
         struct obd_export *exp;
 
        spin_lock(&obd->obd_dev_lock);
        list_for_each_entry(exp, &obd->obd_exports, exp_obd_chain)
-               print_export_data(exp, "ACTIVE", locks);
+               print_export_data(exp, "ACTIVE", locks, debug_level);
        list_for_each_entry(exp, &obd->obd_unlinked_exports, exp_obd_chain)
        list_for_each_entry(exp, &obd->obd_unlinked_exports, exp_obd_chain)
-               print_export_data(exp, "UNLINKED", locks);
+               print_export_data(exp, "UNLINKED", locks, debug_level);
        list_for_each_entry(exp, &obd->obd_delayed_exports, exp_obd_chain)
        list_for_each_entry(exp, &obd->obd_delayed_exports, exp_obd_chain)
-               print_export_data(exp, "DELAYED", locks);
+               print_export_data(exp, "DELAYED", locks, debug_level);
        spin_unlock(&obd->obd_dev_lock);
        spin_lock(&obd_zombie_impexp_lock);
        list_for_each_entry(exp, &obd_zombie_exports, exp_obd_chain)
        spin_unlock(&obd->obd_dev_lock);
        spin_lock(&obd_zombie_impexp_lock);
        list_for_each_entry(exp, &obd_zombie_exports, exp_obd_chain)
-               print_export_data(exp, "ZOMBIE", locks);
+               print_export_data(exp, "ZOMBIE", locks, debug_level);
        spin_unlock(&obd_zombie_impexp_lock);
 }
 
        spin_unlock(&obd_zombie_impexp_lock);
 }
 
@@ -1598,7 +1599,7 @@ void obd_exports_barrier(struct obd_device *obd)
                                      "The obd refcount = %d. Is it stuck?\n",
                                      obd->obd_name, waited,
                                      atomic_read(&obd->obd_refcount));
                                      "The obd refcount = %d. Is it stuck?\n",
                                      obd->obd_name, waited,
                                      atomic_read(&obd->obd_refcount));
-                       dump_exports(obd, 1);
+                       dump_exports(obd, 1, D_CONSOLE | D_WARNING);
                }
                waited *= 2;
                spin_lock(&obd->obd_dev_lock);
                }
                waited *= 2;
                spin_lock(&obd->obd_dev_lock);
index 94bd02f..0bc01d9 100644 (file)
@@ -674,7 +674,7 @@ int class_cleanup(struct obd_device *obd, struct lustre_cfg *lcfg)
                   by other things as well, so don't count on it. */
                CDEBUG(D_IOCTL, "%s: forcing exports to disconnect: %d\n",
                       obd->obd_name, atomic_read(&obd->obd_refcount) - 3);
                   by other things as well, so don't count on it. */
                CDEBUG(D_IOCTL, "%s: forcing exports to disconnect: %d\n",
                       obd->obd_name, atomic_read(&obd->obd_refcount) - 3);
-               dump_exports(obd, 0);
+               dump_exports(obd, 0, D_HA);
                class_disconnect_exports(obd);
        }
 
                class_disconnect_exports(obd);
        }