summaryrefslogtreecommitdiff
path: root/src/osd/OSD.cc
diff options
context:
space:
mode:
authorSage Weil <sage@inktank.com>2013-05-22 15:03:50 -0700
committerSage Weil <sage@inktank.com>2013-05-22 15:03:50 -0700
commitc2e262fc9493b4bb22c2b7b4990aa1ee7846940e (patch)
tree6386d74567594df65275d246698110b8e5a29fc2 /src/osd/OSD.cc
parent32dc463ad4e3c3d4ddec2adf40e2fccde11c2c27 (diff)
downloadceph-c2e262fc9493b4bb22c2b7b4990aa1ee7846940e.tar.gz
osd: skip mark-me-down message if osd is not up
Fixes crash when the OSD has not successfully booted and gets a SIGINT or SIGTERM. Signed-off-by: Sage Weil <sage@inktank.com>
Diffstat (limited to 'src/osd/OSD.cc')
-rw-r--r--src/osd/OSD.cc29
1 files changed, 14 insertions, 15 deletions
diff --git a/src/osd/OSD.cc b/src/osd/OSD.cc
index e64f181831b..b4f52afb93c 100644
--- a/src/osd/OSD.cc
+++ b/src/osd/OSD.cc
@@ -4144,21 +4144,20 @@ bool OSDService::prepare_to_stop() {
if (state != NOT_STOPPING)
return false;
- state = PREPARING_TO_STOP;
- monc->send_mon_message(
- new MOSDMarkMeDown(
- monc->get_fsid(),
- get_osdmap()->get_inst(whoami),
- get_osdmap()->get_epoch(),
- false
- ));
- utime_t now = ceph_clock_now(g_ceph_context);
- utime_t timeout;
- timeout.set_from_double(
- now + g_conf->osd_mon_shutdown_timeout);
- while ((ceph_clock_now(g_ceph_context) < timeout) &&
- (state != STOPPING)) {
- is_stopping_cond.WaitUntil(is_stopping_lock, timeout);
+ if (get_osdmap()->is_up(whoami)) {
+ state = PREPARING_TO_STOP;
+ monc->send_mon_message(new MOSDMarkMeDown(monc->get_fsid(),
+ get_osdmap()->get_inst(whoami),
+ get_osdmap()->get_epoch(),
+ false
+ ));
+ utime_t now = ceph_clock_now(g_ceph_context);
+ utime_t timeout;
+ timeout.set_from_double(now + g_conf->osd_mon_shutdown_timeout);
+ while ((ceph_clock_now(g_ceph_context) < timeout) &&
+ (state != STOPPING)) {
+ is_stopping_cond.WaitUntil(is_stopping_lock, timeout);
+ }
}
state = STOPPING;
return true;