]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
osd: correct the boot msg epoch in _send_boot() 12623/head
authorMingxin Liu <mingxin@xsky.com>
Mon, 19 Dec 2016 08:53:41 +0000 (16:53 +0800)
committerMingxin Liu <mingxin@xsky.com>
Thu, 22 Dec 2016 12:58:55 +0000 (20:58 +0800)
use get_osdmap_epoch() maybe better than superblock's current_epoch, because
_send_boot() might happen when committing new osdmap, superblock.current_epoch
prior to osdmap.epoch, _committed_osd_map() may modify some osd metadata thereafter,
thus, break the consistency between epoch and metadata in boot msg.

Signed-off-by: Mingxin Liu <mingxin@xsky.com>
src/messages/MOSDBoot.h
src/osd/OSD.cc

index 206ffebb122be5349da09d249d8d50ee944c6ad1..74e6e0a844e114c3c7cad0bde96fed35b2b3cce2 100644 (file)
@@ -37,12 +37,12 @@ class MOSDBoot : public PaxosServiceMessage {
     : PaxosServiceMessage(MSG_OSD_BOOT, 0, HEAD_VERSION, COMPAT_VERSION),
       boot_epoch(0), osd_features(0)
   { }
-  MOSDBoot(OSDSuperblock& s, epoch_t be,
+  MOSDBoot(OSDSuperblock& s, epoch_t e, epoch_t be,
           const entity_addr_t& hb_back_addr_ref,
           const entity_addr_t& hb_front_addr_ref,
            const entity_addr_t& cluster_addr_ref,
           uint64_t feat)
-    : PaxosServiceMessage(MSG_OSD_BOOT, s.current_epoch, HEAD_VERSION, COMPAT_VERSION),
+    : PaxosServiceMessage(MSG_OSD_BOOT, e, HEAD_VERSION, COMPAT_VERSION),
       sb(s),
       hb_back_addr(hb_back_addr_ref),
       hb_front_addr(hb_front_addr_ref),
index a5963412e0db9c9511fe416a7e39cda245190f25..657273afda9b04a864566b41ab5df02f4cbf1e4c 100644 (file)
@@ -5084,7 +5084,7 @@ void OSD::_send_boot()
       hb_front_server_messenger->ms_deliver_handle_fast_connect(local_connection);
   }
 
-  MOSDBoot *mboot = new MOSDBoot(superblock, service.get_boot_epoch(),
+  MOSDBoot *mboot = new MOSDBoot(superblock, get_osdmap_epoch(), service.get_boot_epoch(),
                                  hb_back_addr, hb_front_addr, cluster_addr,
                                 CEPH_FEATURES_ALL);
   dout(10) << " client_addr " << client_messenger->get_myaddr()