From: John Spray Date: Tue, 28 Jul 2015 07:57:08 +0000 (+0100) Subject: mds: reinstate conditional destruction X-Git-Tag: v9.1.0~406^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=61643c14f2e7eff0acebb4a2f2d5d4399eb3b022;p=ceph.git mds: reinstate conditional destruction Still got xlist not empty asserts on deletion of MDSRank, so reinstate the condition that we only delete on is_stopped(). Additionally, allow deletion in the case that we never had a rank to begin with. Signed-off-by: John Spray --- diff --git a/src/ceph_mds.cc b/src/ceph_mds.cc index f8d4420c477a..91ff002e1edd 100644 --- a/src/ceph_mds.cc +++ b/src/ceph_mds.cc @@ -236,8 +236,12 @@ int main(int argc, const char **argv) pidfile_remove(); - delete mds; - delete msgr; + // only delete if it was a clean shutdown (to aid memory leak + // detection, etc.). don't bother if it was a suicide. + if (mds->is_clean_shutdown()) { + delete mds; + delete msgr; + } g_ceph_context->put(); diff --git a/src/mds/MDSDaemon.cc b/src/mds/MDSDaemon.cc index 5093f594738f..0ab6473c98f0 100644 --- a/src/mds/MDSDaemon.cc +++ b/src/mds/MDSDaemon.cc @@ -1317,3 +1317,12 @@ void MDSDaemon::ms_handle_accept(Connection *con) } } +bool MDSDaemon::is_clean_shutdown() +{ + if (mds_rank) { + return mds_rank->is_stopped(); + } else { + return true; + } +} + diff --git a/src/mds/MDSDaemon.h b/src/mds/MDSDaemon.h index 3203ec1af5a9..ba3f456e9c07 100644 --- a/src/mds/MDSDaemon.h +++ b/src/mds/MDSDaemon.h @@ -112,6 +112,14 @@ class MDSDaemon : public Dispatcher, public md_config_obs_t { // start up, shutdown int init(MDSMap::DaemonState wanted_state=MDSMap::STATE_BOOT); + /** + * Hint at whether we were shutdown gracefully (i.e. we were only + * in standby, or our rank was stopped). Should be removed once + * we handle shutdown properly (e.g. clear out all message queues) + * such that deleting xlists doesn't assert. + */ + bool is_clean_shutdown(); + // config observer bits virtual const char** get_tracked_conf_keys() const; virtual void handle_conf_change(const struct md_config_t *conf,