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/Objecter: fix recursive locking in _finish_command #21742

Merged
merged 1 commit into from
May 1, 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
13 changes: 10 additions & 3 deletions src/osdc/Objecter.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1708,14 +1708,17 @@ void Objecter::C_Command_Map_Latest::finish(int r)
if (c->map_dne_bound == 0)
c->map_dne_bound = latest;

OSDSession::unique_lock sul(c->session->lock);
objecter->_check_command_map_dne(c);
sul.unlock();

c->put();
}

void Objecter::_check_command_map_dne(CommandOp *c)
{
// rwlock is locked unique
// session is locked unique

ldout(cct, 10) << "_check_command_map_dne tid " << c->tid
<< " current " << osdmap->get_epoch()
Expand All @@ -1733,6 +1736,7 @@ void Objecter::_check_command_map_dne(CommandOp *c)
void Objecter::_send_command_map_check(CommandOp *c)
{
// rwlock is locked unique
// session is locked unique

// ask the monitor
if (check_latest_map_commands.count(c->tid) == 0) {
Expand Down Expand Up @@ -4781,8 +4785,10 @@ void Objecter::handle_command_reply(MCommandReply *m)

sl.unlock();


OSDSession::unique_lock sul(s->lock);
_finish_command(c, m->r, m->rs);
sul.unlock();

m->put();
s->put();
}
Expand Down Expand Up @@ -4928,13 +4934,16 @@ int Objecter::command_op_cancel(OSDSession *s, ceph_tid_t tid, int r)

CommandOp *op = it->second;
_command_cancel_map_check(op);
OSDSession::unique_lock sl(op->session->lock);
_finish_command(op, r, "");
sl.unlock();
return 0;
}

void Objecter::_finish_command(CommandOp *c, int r, string rs)
{
// rwlock is locked unique
// session lock is locked

ldout(cct, 10) << "_finish_command " << c->tid << " = " << r << " "
<< rs << dendl;
Expand All @@ -4947,9 +4956,7 @@ void Objecter::_finish_command(CommandOp *c, int r, string rs)
timer.cancel_event(c->ontimeout);

OSDSession *s = c->session;
OSDSession::unique_lock sl(s->lock);
_session_command_op_remove(c->session, c);
sl.unlock();

c->put();

Expand Down