From 5d8f6742e65d588d907b77ffc6fcdb2552d855b9 Mon Sep 17 00:00:00 2001 From: Alexander Boyko Date: Tue, 11 May 2021 05:33:36 -0400 Subject: [PATCH] LU-13811 client: don't panic for mgs evictions 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 Signed-off-by: Ben Evans Change-Id: Iaa8b06f52fa22ac891b569bc8a2271c8e1e63a3b Reviewed-on: https://review.whamcloud.com/43655 Tested-by: jenkins Tested-by: Maloo Reviewed-by: Andriy Skulysh Reviewed-by: Alexander Zarochentsev Reviewed-by: Oleg Drokin --- lustre/include/obd_class.h | 15 +++++++++++++++ lustre/ldlm/ldlm_lib.c | 2 ++ lustre/ldlm/ldlm_lockd.c | 5 +++-- lustre/ptlrpc/import.c | 27 +++++++++++++-------------- 4 files changed, 33 insertions(+), 16 deletions(-) diff --git a/lustre/include/obd_class.h b/lustre/include/obd_class.h index a1b087e..093682f 100644 --- a/lustre/include/obd_class.h +++ b/lustre/include/obd_class.h @@ -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); diff --git a/lustre/ldlm/ldlm_lib.c b/lustre/ldlm/ldlm_lib.c index bb6a2f0..4d37048 100644 --- a/lustre/ldlm/ldlm_lib.c +++ b/lustre/ldlm/ldlm_lib.c @@ -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); diff --git a/lustre/ldlm/ldlm_lockd.c b/lustre/ldlm/ldlm_lockd.c index 23bd76f..ebaa261 100644 --- a/lustre/ldlm/ldlm_lockd.c +++ b/lustre/ldlm/ldlm_lockd.c @@ -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(); } diff --git a/lustre/ptlrpc/import.c b/lustre/ptlrpc/import.c index 969199b..3b18d4a 100644 --- a/lustre/ptlrpc/import.c +++ b/lustre/ptlrpc/import.c @@ -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); } /** -- 1.8.3.1