From: Patrick Donnelly Date: Tue, 25 Jul 2023 19:07:21 +0000 (-0400) Subject: mds: flush monc log before abort X-Git-Tag: v18.2.1~110^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=d8db3fc5e818046fea864bcb598890c8b9d2c660;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 6f20f53d144d..eda37ccb4df7 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 2bb5b7d7bb8a..13f8e015f3da 100644 --- a/src/mds/MDSRank.cc +++ b/src/mds/MDSRank.cc @@ -931,6 +931,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 c52c837083b9..ca61a10b4b12 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