diff options
author | Sage Weil <sage@inktank.com> | 2013-07-16 16:25:28 -0700 |
---|---|---|
committer | Sage Weil <sage@inktank.com> | 2013-07-17 14:38:57 -0700 |
commit | 994e2bf224ab7b7d5b832485ee14de05354d2ddf (patch) | |
tree | df6c38f6334d0849f2513111962901504c7ce776 | |
parent | 07a0860a1899c7353bb506e33de72fdd22b857dd (diff) | |
download | ceph-994e2bf224ab7b7d5b832485ee14de05354d2ddf.tar.gz |
msgr: adjust nonce on rebind()
We can have a situation where:
- we have a pipe to a peer
- pipe goes to standby (on peer)
- we rebind to a new port
- ....
- we rebind again to the same old port
- we connect to peer
and get reattached to the ancient pipe from two instances back. Avoid that
by picking a new nonce each time we rebind.
Add 1,000,000 each time so that the port is still legible in the printed
output.
Signed-off-by: Sage Weil <sage@inktank.com>
-rw-r--r-- | src/msg/Accepter.cc | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/src/msg/Accepter.cc b/src/msg/Accepter.cc index 4d13be8fdca..d6e94d1cc51 100644 --- a/src/msg/Accepter.cc +++ b/src/msg/Accepter.cc @@ -165,6 +165,11 @@ int Accepter::rebind(const set<int>& avoid_ports) new_avoid.insert(addr.get_port()); addr.set_port(0); + // adjust the nonce; we want our entity_addr_t to be truly unique. + nonce += 1000000; + msgr->my_inst.addr.nonce = nonce; + ldout(msgr->cct,10) << " new nonce " << nonce << " and inst " << msgr->my_inst << dendl; + ldout(msgr->cct,10) << " will try " << addr << " and avoid ports " << new_avoid << dendl; int r = bind(addr, new_avoid); if (r == 0) |