From: Patrick Donnelly Date: Tue, 25 Jul 2023 19:07:21 +0000 (-0400) Subject: mds: flush monc log before abort X-Git-Tag: v16.2.15~145^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=5fab4c6fc132fb634987e58758e42af4775e3f93;p=ceph.git 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) --- diff --git a/src/mds/CDentry.cc b/src/mds/CDentry.cc index 7366ecd928a0..169b777968d3 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 71b89e93e418..59eaee985834 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 d674917b48a7..5cc2dd67a4fe 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