Skip to content

Commit

Permalink
osdc: Fix race condition with tick_event and shutdown
Browse files Browse the repository at this point in the history
  - Clear the tick_event whether it was in the timer queue or not.
  - Make sure we don't schedule a new tick_event if someone calls shutdown while
    tick() is running
  - Get rid of some assertions that aren't relevant

Fixes #14256
  • Loading branch information
adamemerson committed Jan 7, 2016
1 parent 6f76419 commit 9179ce8
Showing 1 changed file with 6 additions and 8 deletions.
14 changes: 6 additions & 8 deletions src/osdc/Objecter.cc
Expand Up @@ -454,8 +454,8 @@ void Objecter::shutdown()
if (tick_event) {
if (timer.cancel_event(tick_event)) {
ldout(cct, 10) << " successfully canceled tick" << dendl;
tick_event = 0;
}
tick_event = 0;
}

if (m_request_state_hook) {
Expand All @@ -473,8 +473,6 @@ void Objecter::shutdown()

// Let go of Objecter write lock so timer thread can shutdown
rwlock.unlock();

assert(tick_event == 0);
}

void Objecter::_send_linger(LingerOp *info)
Expand Down Expand Up @@ -1986,7 +1984,6 @@ void Objecter::tick()
ldout(cct, 10) << "tick" << dendl;

// we are only called by C_Tick
assert(tick_event);
tick_event = 0;

if (!initialized.read()) {
Expand Down Expand Up @@ -2062,9 +2059,11 @@ void Objecter::tick()
}
}

// reschedule
tick_event = timer.reschedule_me(ceph::make_timespan(
cct->_conf->objecter_tick_interval));
// Make sure we don't resechedule if we wake up after shutdown
if (initialized.read()) {
tick_event = timer.reschedule_me(ceph::make_timespan(
cct->_conf->objecter_tick_interval));
}
}

void Objecter::resend_mon_ops()
Expand Down Expand Up @@ -4795,7 +4794,6 @@ Objecter::~Objecter()
assert(check_latest_map_ops.empty());
assert(check_latest_map_commands.empty());

assert(!tick_event);
assert(!m_request_state_hook);
assert(!logger);
}
Expand Down

0 comments on commit 9179ce8

Please sign in to comment.