Skip to content

Commit

Permalink
Nonce fix: ceph#11804
Browse files Browse the repository at this point in the history
Signed-off-by: Willem Jan Withagen <wjw@digiware.nl>
  • Loading branch information
wjwithagen committed Nov 11, 2016
1 parent 9a31b48 commit ddc310b
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 10 deletions.
2 changes: 1 addition & 1 deletion src/msg/SimplePolicyMessenger.h
Expand Up @@ -31,7 +31,7 @@ class SimplePolicyMessenger : public Messenger
public:

SimplePolicyMessenger(CephContext *cct, entity_name_t name,
string mname, uint64_t _nonce)
string mname, uint32_t _nonce)
: Messenger(cct, name),
policy_lock("SimplePolicyMessenger::policy_lock")
{
Expand Down
7 changes: 4 additions & 3 deletions src/msg/async/AsyncMessenger.cc
Expand Up @@ -148,7 +148,7 @@ int Processor::bind(const entity_addr_t &bind_addr, const set<int>& avoid_ports)
msgr->set_myaddr(listen_addr);
}
entity_addr_t addr = msgr->get_myaddr();
addr.nonce = nonce;
addr.set_nonce(nonce);
msgr->set_myaddr(addr);

msgr->init_local_connection();
Expand All @@ -172,7 +172,8 @@ int Processor::rebind(const set<int>& avoid_ports)
ldout(msgr->cct, 10) << __func__ << " Proc new nonce " << nonce << " and inst " << msgr->my_inst << dendl;

ldout(msgr->cct, 10) << __func__ << " Proc will try " << msgr->my_inst.addr << " and avoid ports " << new_avoid << dendl;
return bind( msgr->my_inst.addr, new_avoid);
// return bind(msgr->my_inst.addr, new_avoid);
return bind(addr, new_avoid);
}

void Processor::start()
Expand Down Expand Up @@ -267,7 +268,7 @@ class C_handle_reap : public EventCallback {
*/

AsyncMessenger::AsyncMessenger(CephContext *cct, entity_name_t name,
string mname, uint64_t _nonce)
string mname, uint32_t _nonce)
: SimplePolicyMessenger(cct, name,mname, _nonce),
dispatch_queue(cct, this, mname),
lock("AsyncMessenger::lock"),
Expand Down
6 changes: 3 additions & 3 deletions src/msg/async/AsyncMessenger.h
Expand Up @@ -49,7 +49,7 @@ class Processor {
NetHandler net;
Worker *worker;
ServerSocket listen_socket;
uint64_t nonce;
uint32_t nonce;
EventCallbackRef listen_handler;

class C_processor_accept;
Expand Down Expand Up @@ -84,7 +84,7 @@ class AsyncMessenger : public SimplePolicyMessenger {
* be a value that will be repeated if the daemon restarts.
*/
AsyncMessenger(CephContext *cct, entity_name_t name,
string mname, uint64_t _nonce);
string mname, uint32_t _nonce);

/**
* Destroy the AsyncMessenger. Pretty simple since all the work is done
Expand Down Expand Up @@ -227,7 +227,7 @@ class AsyncMessenger : public SimplePolicyMessenger {
Mutex lock;
// AsyncMessenger stuff
/// approximately unique ID set by the Constructor for use in entity_addr_t
uint64_t nonce;
uint32_t nonce;

/// true, specifying we haven't learned our addr; set false when we find it.
// maybe this should be protected by the lock?
Expand Down
2 changes: 1 addition & 1 deletion src/msg/simple/SimpleMessenger.cc
Expand Up @@ -39,7 +39,7 @@ static ostream& _prefix(std::ostream *_dout, SimpleMessenger *msgr) {
*/

SimpleMessenger::SimpleMessenger(CephContext *cct, entity_name_t name,
string mname, uint64_t _nonce)
string mname, uint32_t _nonce)
: SimplePolicyMessenger(cct, name,mname, _nonce),
accepter(this, _nonce),
dispatch_queue(cct, this, mname),
Expand Down
4 changes: 2 additions & 2 deletions src/msg/simple/SimpleMessenger.h
Expand Up @@ -82,7 +82,7 @@ class SimpleMessenger : public SimplePolicyMessenger {
* features The local features bits for the local_connection
*/
SimpleMessenger(CephContext *cct, entity_name_t name,
string mname, uint64_t _nonce);
string mname, uint32_t _nonce);

/**
* Destroy the SimpleMessenger. Pretty simple since all the work is done
Expand Down Expand Up @@ -262,7 +262,7 @@ class SimpleMessenger : public SimplePolicyMessenger {

// SimpleMessenger stuff
/// approximately unique ID set by the Constructor for use in entity_addr_t
uint64_t nonce;
uint32_t nonce;
/// overall lock used for SimpleMessenger data structures
Mutex lock;
/// true, specifying we haven't learned our addr; set false when we find it.
Expand Down

0 comments on commit ddc310b

Please sign in to comment.