Skip to content

Commit

Permalink
msg/async: fix missing unlock when already bind
Browse files Browse the repository at this point in the history
Signed-off-by: Haomai Wang <haomai@xsky.com>
  • Loading branch information
yuyuyu101 committed Feb 18, 2017
1 parent 452986c commit 067d569
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 7 deletions.
4 changes: 1 addition & 3 deletions src/msg/async/AsyncMessenger.cc
Expand Up @@ -393,18 +393,16 @@ int AsyncMessenger::rebind(const set<int>& avoid_ports)

int AsyncMessenger::client_bind(const entity_addr_t &bind_addr)
{
lock.Lock();
Mutex::Locker l(lock);
if (did_bind) {
assert(my_inst.addr == bind_addr);
return 0;
}
if (started) {
ldout(cct, 10) << __func__ << " already started" << dendl;
lock.Unlock();
return -1;
}
ldout(cct, 10) << __func__ << " " << bind_addr << dendl;
lock.Unlock();

set_myaddr(bind_addr);
return 0;
Expand Down
5 changes: 1 addition & 4 deletions src/msg/simple/SimpleMessenger.cc
Expand Up @@ -309,19 +309,16 @@ int SimpleMessenger::rebind(const set<int>& avoid_ports)

int SimpleMessenger::client_bind(const entity_addr_t &bind_addr)
{
lock.Lock();
Mutex::Locker l(lock);
if (did_bind) {
assert(my_inst.addr == bind_addr);
lock.Unlock();
return 0;
}
if (started) {
ldout(cct,10) << "rank.bind already started" << dendl;
lock.Unlock();
return -1;
}
ldout(cct,10) << "rank.bind " << bind_addr << dendl;
lock.Unlock();

set_myaddr(bind_addr);
return 0;
Expand Down

0 comments on commit 067d569

Please sign in to comment.