From: Sage Weil Date: Wed, 22 May 2013 22:03:50 +0000 (-0700) Subject: osd: skip mark-me-down message if osd is not up X-Git-Tag: v0.63~7 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=c2e262fc9493b4bb22c2b7b4990aa1ee7846940e;p=ceph.git 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 --- diff --git a/src/osd/OSD.cc b/src/osd/OSD.cc index e64f181831b4..b4f52afb93c3 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;