From 0bf4f652b7c98f0746a93dc931953682811ad03d Mon Sep 17 00:00:00 2001 From: Sage Weil Date: Mon, 7 Jul 2014 16:06:49 -0700 Subject: [PATCH] osd: clear sessions_waiting_on_map on shutdown Wake up these ops and drop the Session refs on shutdown. Signed-off-by: Sage Weil --- src/osd/OSD.cc | 19 ++++++++----------- src/osd/OSD.h | 12 ++++++++++++ 2 files changed, 20 insertions(+), 11 deletions(-) diff --git a/src/osd/OSD.cc b/src/osd/OSD.cc index 0087e9b57a9f7..597678722e6aa 100644 --- a/src/osd/OSD.cc +++ b/src/osd/OSD.cc @@ -1626,7 +1626,9 @@ int OSD::shutdown() cct->_conf->set_val("debug_filestore", "100"); cct->_conf->set_val("debug_ms", "100"); cct->_conf->apply_changes(NULL); - + + dispatch_sessions_waiting_on_map(); + // Shutdown PGs { RWLock::RLocker l(pg_map_lock); @@ -4981,6 +4983,10 @@ void OSD::dispatch_session_waiting(Session *session, OSDMapRef osdmap) void OSD::ms_fast_dispatch(Message *m) { + if (service.is_stopping()) { + m->put(); + return; + } OpRequestRef op = op_tracker.create_request(m); OSDMapRef nextmap = service.get_nextmap_reserved(); Session *session = static_cast(m->get_connection()->get_priv()); @@ -6249,16 +6255,7 @@ void OSD::consume_map() service.await_reserved_maps(); service.publish_map(osdmap); - set sessions_to_check; - get_sessions_waiting_for_map(&sessions_to_check); - for (set::iterator i = sessions_to_check.begin(); - i != sessions_to_check.end(); - sessions_to_check.erase(i++)) { - (*i)->session_dispatch_lock.Lock(); - dispatch_session_waiting(*i, osdmap); - (*i)->session_dispatch_lock.Unlock(); - (*i)->put(); - } + dispatch_sessions_waiting_on_map(); // remove any PGs which we no longer host from the waiting_for_pg list set pgs_to_delete; diff --git a/src/osd/OSD.h b/src/osd/OSD.h index 6a5b5fb718e88..1926b42d74a98 100644 --- a/src/osd/OSD.h +++ b/src/osd/OSD.h @@ -1179,6 +1179,18 @@ public: session_waiting_for_map.erase(i); } } + void dispatch_sessions_waiting_on_map() { + set sessions_to_check; + get_sessions_waiting_for_map(&sessions_to_check); + for (set::iterator i = sessions_to_check.begin(); + i != sessions_to_check.end(); + sessions_to_check.erase(i++)) { + (*i)->session_dispatch_lock.Lock(); + dispatch_session_waiting(*i, osdmap); + (*i)->session_dispatch_lock.Unlock(); + (*i)->put(); + } + } private: /** -- 2.39.5