dispatch_running(false),
asok_hook(NULL),
osd_compat(get_osd_compat_set()),
- state(STATE_INITIALIZING), boot_epoch(0), up_epoch(0), bind_epoch(0),
+ state(STATE_INITIALIZING), epoch_lock(), boot_epoch(0), up_epoch(0), bind_epoch(0),
op_tp(cct, "OSD::op_tp", cct->_conf->osd_op_threads, "osd_op_threads"),
recovery_tp(cct, "OSD::recovery_tp", cct->_conf->osd_recovery_threads, "osd_recovery_threads"),
disk_tp(cct, "OSD::disk_tp", cct->_conf->osd_disk_threads, "osd_disk_threads"),
create_recoverystate_perf();
+ epoch_lock.lock();
bind_epoch = osdmap->get_epoch();
+ epoch_lock.unlock();
// load up pgs (as they previously existed)
load_pgs();
// note unmount epoch
dout(10) << "noting clean unmount in epoch " << osdmap->get_epoch() << dendl;
+ epoch_lock.lock();
superblock.mounted = boot_epoch;
+ epoch_lock.unlock();
superblock.clean_thru = osdmap->get_epoch();
ObjectStore::Transaction t;
write_superblock(t);
dout(10) << " assuming hb_front_addr ip matches client_addr" << dendl;
}
- MOSDBoot *mboot = new MOSDBoot(superblock, boot_epoch, hb_back_addr, hb_front_addr, cluster_addr);
+ epoch_lock.lock();
+ epoch_t _boot_epoch = boot_epoch;
+ epoch_lock.unlock();
+ MOSDBoot *mboot = new MOSDBoot(superblock, _boot_epoch, hb_back_addr, hb_front_addr, cluster_addr);
dout(10) << " client_addr " << client_messenger->get_myaddr()
<< ", cluster_addr " << cluster_addr
<< ", hb_back_addr " << hb_back_addr
had_map_since = ceph_clock_now(cct);
}
+ epoch_lock.lock();
+ epoch_t _bind_epoch = bind_epoch;
+ epoch_lock.unlock();
if (osdmap->is_up(whoami) &&
osdmap->get_addr(whoami) == client_messenger->get_myaddr() &&
- bind_epoch < osdmap->get_up_from(whoami)) {
+ _bind_epoch < osdmap->get_up_from(whoami)) {
if (is_booting()) {
dout(1) << "state: booting -> active" << dendl;
<< " != my " << hb_front_server_messenger->get_myaddr() << ")";
if (!service.is_stopping()) {
+ epoch_lock.lock();
up_epoch = 0;
do_restart = true;
bind_epoch = osdmap->get_epoch();
+ epoch_lock.unlock();
start_waiting_for_healthy();
// note in the superblock that we were clean thru the prior epoch
+ epoch_lock.lock();
if (boot_epoch && boot_epoch >= superblock.mounted) {
superblock.mounted = boot_epoch;
superblock.clean_thru = osdmap->get_epoch();
}
+ epoch_lock.unlock();
// superblock and commit
write_superblock(t);
dout(7) << "advance_map epoch " << osdmap->get_epoch()
<< dendl;
+ epoch_lock.lock();
if (!up_epoch &&
osdmap->is_up(whoami) &&
osdmap->get_inst(whoami) == client_messenger->get_myinst()) {
dout(10) << "boot_epoch is " << boot_epoch << dendl;
}
}
+ epoch_lock.unlock();
// scan pg creations
ceph::unordered_map<spg_t, create_pg_info>::iterator n = creating_pgs.begin();
return false;
}
- if (epoch < up_epoch) {
- dout(7) << "from pre-up epoch " << epoch << " < " << up_epoch << dendl;
+ epoch_lock.lock();
+ epoch_t _epoch = epoch;
+ epoch_lock.unlock();
+ if (_epoch < up_epoch) {
+ dout(7) << "from pre-up epoch " << epoch << " < " << _epoch << dendl;
return false;
}
assert(m->get_header().type == MSGTYPE);
dout(10) << __func__ << " " << *m << " epoch " << m->map_epoch << dendl;
- if (m->map_epoch < up_epoch) {
+ epoch_lock.lock();
+ epoch_t _up_epoch = up_epoch;
+ epoch_lock.unlock();
+ if (m->map_epoch < _up_epoch) {
dout(3) << "replica op from before up" << dendl;
return;
}