From: Laura Flores Date: Thu, 10 Nov 2022 23:25:04 +0000 (-0600) Subject: osd: shut down the MgrClient before osd_fast_shutdown X-Git-Tag: v18.1.0~448^2 X-Git-Url: http://git.apps.os.sepia.ceph.com/?a=commitdiff_plain;h=77ebbf580bee3bf83de0da03487b6ebb08c17d76;p=ceph-ci.git osd: shut down the MgrClient before osd_fast_shutdown We should shut down the MgrClient before osd_fast_shutdown. This approach avoids a race condition that sometimes occurs when the MgrClient attempts to gather `pg_stats` from the database after it has been unmounted, or when it is in the process of being unmounted. Fixes: https://tracker.ceph.com/issues/56101 Signed-off-by: Laura Flores Signed-off-by: Brad Hubbard --- diff --git a/src/osd/OSD.cc b/src/osd/OSD.cc index dc3f7f5da8b..a16ec82d728 100644 --- a/src/osd/OSD.cc +++ b/src/osd/OSD.cc @@ -4353,6 +4353,12 @@ int OSD::shutdown() cct->_conf.apply_changes(nullptr); } + // stop MgrClient earlier as it's more like an internal consumer of OSD + // + // should occur before unmounting the database in fast-shutdown to avoid + // a race condition (see https://tracker.ceph.com/issues/56101) + mgrc.shutdown(); + if (cct->_conf->osd_fast_shutdown) { // first, stop new task from being taken from op_shardedwq // and clear all pending tasks @@ -4392,9 +4398,6 @@ int OSD::shutdown() _exit(0); } - // stop MgrClient earlier as it's more like an internal consumer of OSD - mgrc.shutdown(); - service.start_shutdown(); // stop sending work to pgs. this just prevents any new work in _process