Whamcloud - gitweb
LU-13811 client: don't panic for mgs evictions 55/43655/3
authorAlexander Boyko <alexander.boyko@hpe.com>
Tue, 11 May 2021 09:33:36 +0000 (05:33 -0400)
committerOleg Drokin <green@whamcloud.com>
Mon, 14 Jun 2021 16:43:46 +0000 (16:43 +0000)
Avoid client panics for MGS evictions.
Create a function to check if the eviction is coming
from an MGS, and if so to ignore it.

Rework dump_on_eviction and lbug_on_eviction so
all logic is handled in one place.

Test-Parameters: trivial
HPE-bug-id: LUS-197
Signed-off-by: Alexander Boyko <alexander.boyko@hpe.com>
Signed-off-by: Ben Evans <jevans@cray.com>
Change-Id: Iaa8b06f52fa22ac891b569bc8a2271c8e1e63a3b
Reviewed-on: https://review.whamcloud.com/43655
Tested-by: jenkins <devops@whamcloud.com>
Tested-by: Maloo <maloo@whamcloud.com>
Reviewed-by: Andriy Skulysh <askulysh@gmail.com>
Reviewed-by: Alexander Zarochentsev <alexander.zarochentsev@hpe.com>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
lustre/include/obd_class.h
lustre/ldlm/ldlm_lib.c
lustre/ldlm/ldlm_lockd.c
lustre/ptlrpc/import.c

index a1b087e..093682f 100644 (file)
@@ -1847,6 +1847,21 @@ int class_check_uuid(struct obd_uuid *uuid, __u64 nid);
 /* class_obd.c */
 extern char obd_jobid_name[];
 
+extern unsigned int obd_lbug_on_eviction;
+extern unsigned int obd_dump_on_eviction;
+
+static inline bool do_dump_on_eviction(struct obd_device *exp_obd)
+{
+       if (obd_lbug_on_eviction &&
+           strncmp(exp_obd->obd_type->typ_name, LUSTRE_MGC_NAME,
+                   strlen(LUSTRE_MGC_NAME))) {
+               CERROR("LBUG upon eviction\n");
+               LBUG();
+       }
+
+       return obd_dump_on_eviction;
+}
+
 /* statfs_pack.c */
 struct kstatfs;
 void statfs_pack(struct obd_statfs *osfs, struct kstatfs *sfs);
index bb6a2f0..4d37048 100644 (file)
@@ -1748,6 +1748,8 @@ static void target_finish_recovery(struct lu_target *lut)
                              atomic_read(&obd->obd_connected_clients),
                              obd->obd_stale_clients,
                              obd->obd_stale_clients == 1 ? "was" : "were");
+               if (obd->obd_stale_clients && do_dump_on_eviction(obd))
+                       libcfs_debug_dumplog();
        }
 
        ldlm_reprocess_recovery_done(obd->obd_namespace);
index 23bd76f..ebaa261 100644 (file)
@@ -258,7 +258,8 @@ static int expired_lock_main(void *arg)
                                           lock->l_blast_sent,
                                           obd_export_nid2str(export));
                                ldlm_lock_to_ns(lock)->ns_timeouts++;
-                               do_dump++;
+                               if (do_dump_on_eviction(export->exp_obd))
+                                       do_dump++;
                                class_fail_export(export);
                        }
                        class_export_lock_put(export, lock);
@@ -272,7 +273,7 @@ static int expired_lock_main(void *arg)
                }
                spin_unlock_bh(&waiting_locks_spinlock);
 
-               if (do_dump && obd_dump_on_eviction) {
+               if (do_dump) {
                        CERROR("dump the log upon eviction\n");
                        libcfs_debug_dumplog();
                }
index 969199b..3b18d4a 100644 (file)
@@ -1504,25 +1504,24 @@ static int signal_completed_replay(struct obd_import *imp)
  */
 static int ptlrpc_invalidate_import_thread(void *data)
 {
-        struct obd_import *imp = data;
+       struct obd_import *imp = data;
 
-        ENTRY;
-        CDEBUG(D_HA, "thread invalidate import %s to %s@%s\n",
-               imp->imp_obd->obd_name, obd2cli_tgt(imp->imp_obd),
-               imp->imp_connection->c_remote_uuid.uuid);
-
-        ptlrpc_invalidate_import(imp);
+       ENTRY;
+       CDEBUG(D_HA, "thread invalidate import %s to %s@%s\n",
+              imp->imp_obd->obd_name, obd2cli_tgt(imp->imp_obd),
+              imp->imp_connection->c_remote_uuid.uuid);
 
-        if (obd_dump_on_eviction) {
-                CERROR("dump the log upon eviction\n");
-                libcfs_debug_dumplog();
-        }
+       if (do_dump_on_eviction(imp->imp_obd)) {
+               CERROR("dump the log upon eviction\n");
+               libcfs_debug_dumplog();
+       }
 
+       ptlrpc_invalidate_import(imp);
        import_set_state(imp, LUSTRE_IMP_RECOVER);
-        ptlrpc_import_recovery_state_machine(imp);
+       ptlrpc_import_recovery_state_machine(imp);
 
-        class_import_put(imp);
-        RETURN(0);
+       class_import_put(imp);
+       RETURN(0);
 }
 
 /**