From 59c5a50bd9e69d58b4cdb9eff68b55fb2ccb4f29 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 --- 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 6f20f53d144..eda37ccb4df 100644 --- a/src/mds/CDentry.cc +++ b/src/mds/CDentry.cc @@ -716,7 +716,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 d0323fbadc2..a43bd3a5bc2 100644 --- a/src/mds/MDSRank.cc +++ b/src/mds/MDSRank.cc @@ -934,6 +934,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 3e353cf962b..084ac6d0ff7 100644 --- a/src/mds/MDSRank.h +++ b/src/mds/MDSRank.h @@ -295,6 +295,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.39.5