From 5fab4c6fc132fb634987e58758e42af4775e3f93 Mon Sep 17 00:00:00 2001 From: Patrick Donnelly Date: Tue, 25 Jul 2023 15:07:21 -0400 Subject: [PATCH] mds: flush monc log before abort These are asynchronously flushed periodically. If the MDS plans to abort (and we know messages are pending), it needs to manually trigger a flush. Signed-off-by: Patrick Donnelly (cherry picked from commit 59c5a50bd9e69d58b4cdb9eff68b55fb2ccb4f29) --- src/mds/CDentry.cc | 2 +- src/mds/MDSRank.cc | 6 ++++++ src/mds/MDSRank.h | 7 +++++++ 3 files changed, 14 insertions(+), 1 deletion(-) diff --git a/src/mds/CDentry.cc b/src/mds/CDentry.cc index 7366ecd928a..169b777968d 100644 --- a/src/mds/CDentry.cc +++ b/src/mds/CDentry.cc @@ -696,7 +696,7 @@ bool CDentry::check_corruption(bool load) } if (!load && g_conf().get_val("mds_abort_on_newly_corrupt_dentry")) { dir->mdcache->mds->clog->error() << "MDS abort because newly corrupt dentry to be committed: " << *this; - ceph_abort("detected newly corrupt dentry"); /* avoid writing out newly corrupted dn */ + dir->mdcache->mds->abort("detected newly corrupt dentry"); /* avoid writing out newly corrupted dn */ } return true; } diff --git a/src/mds/MDSRank.cc b/src/mds/MDSRank.cc index 71b89e93e41..59eaee98583 100644 --- a/src/mds/MDSRank.cc +++ b/src/mds/MDSRank.cc @@ -926,6 +926,12 @@ void MDSRank::respawn() } } +void MDSRank::abort(std::string_view msg) +{ + monc->flush_log(); + ceph_abort(msg); +} + void MDSRank::damaged() { ceph_assert(whoami != MDS_RANK_NONE); diff --git a/src/mds/MDSRank.h b/src/mds/MDSRank.h index d674917b48a..5cc2dd67a4f 100644 --- a/src/mds/MDSRank.h +++ b/src/mds/MDSRank.h @@ -296,6 +296,13 @@ class MDSRank { return count * _heartbeat_reset_grace; } + /** + * Abort the MDS and flush any clog messages. + * + * Callers must already hold mds_lock. + */ + void abort(std::string_view msg); + /** * Report state DAMAGED to the mon, and then pass on to respawn(). Call * this when an unrecoverable error is encountered while attempting -- 2.47.3