Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

osdc: Fix race condition with tick_event and shutdown #7151

Merged
merged 1 commit into from Jan 13, 2016
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if we clear tick_event in tick() and when we cancel both, can't we keep this?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Arguably yes. I got rid of this since getting rid of the asserts was the suggested way to solve the problem of not having a lock on the class when reading them without making them atomic.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

}
Expand Down