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

msg/async: avoid put message within write_lock #20731

Merged
merged 1 commit into from May 14, 2018
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
12 changes: 9 additions & 3 deletions src/msg/async/AsyncConnection.cc
Expand Up @@ -2299,15 +2299,21 @@ void AsyncConnection::handle_ack(uint64_t seq)
{
ldout(async_msgr->cct, 15) << __func__ << " got ack seq " << seq << dendl;
// trim sent list
std::lock_guard<std::mutex> l(write_lock);
while (!sent.empty() && sent.front()->get_seq() <= seq) {
static const int max_pending = 128;
int i = 0;
Message *pending[max_pending];
write_lock.lock();
while (!sent.empty() && sent.front()->get_seq() <= seq && i < max_pending) {
Message* m = sent.front();
sent.pop_front();
pending[i++] = m;
ldout(async_msgr->cct, 10) << __func__ << " got ack seq "
<< seq << " >= " << m->get_seq() << " on "
<< m << " " << *m << dendl;
m->put();
}
write_lock.unlock();
for (int k = 0; k < i; k++)
pending[k]->put();
}

void AsyncConnection::DelayedDelivery::do_request(uint64_t id)
Expand Down