]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
mds: fix integer truncation 4427/head
authorHenry Chang <henry@bigtera.com>
Wed, 22 Apr 2015 03:52:18 +0000 (11:52 +0800)
committerHenry Chang <henry@bigtera.com>
Wed, 22 Apr 2015 04:17:39 +0000 (12:17 +0800)
Client ID is a 64-bit integer. Unlike Ceph daemons, it may go beyond
2147483647 and cause problems.

Signed-off-by: Henry Chang <henry@bigtera.com>
src/mds/Server.cc
src/msg/msg_types.h

index db6b8e9adc46eba702a6a5d68dcdd73553ea946e..a73843c539553b5fe7b80fde9d7ab45102843bc0 100644 (file)
@@ -695,7 +695,7 @@ void Server::reconnect_clients()
 void Server::handle_client_reconnect(MClientReconnect *m)
 {
   dout(7) << "handle_client_reconnect " << m->get_source() << dendl;
-  int from = m->get_source().num();
+  client_t from = m->get_source().num();
   Session *session = get_session(m);
   assert(session);
 
index 9c0f266d2b48a0197f3cdf02db75598c78c5355f..4f4629b2d67d94f684bba5d5c9a29de10e679e09 100644 (file)
@@ -39,7 +39,7 @@ public:
   static const int TYPE_OSD = CEPH_ENTITY_TYPE_OSD;
   static const int TYPE_CLIENT = CEPH_ENTITY_TYPE_CLIENT;
 
-  static const int NEW = -1;
+  static const int64_t NEW = -1;
 
   // cons
   entity_name_t() : _type(0), _num(0) { }
@@ -48,10 +48,10 @@ public:
     _type(n.type), _num(n.num) { }
 
   // static cons
-  static entity_name_t MON(int i=NEW) { return entity_name_t(TYPE_MON, i); }
-  static entity_name_t MDS(int i=NEW) { return entity_name_t(TYPE_MDS, i); }
-  static entity_name_t OSD(int i=NEW) { return entity_name_t(TYPE_OSD, i); }
-  static entity_name_t CLIENT(int i=NEW) { return entity_name_t(TYPE_CLIENT, i); }
+  static entity_name_t MON(int64_t i=NEW) { return entity_name_t(TYPE_MON, i); }
+  static entity_name_t MDS(int64_t i=NEW) { return entity_name_t(TYPE_MDS, i); }
+  static entity_name_t OSD(int64_t i=NEW) { return entity_name_t(TYPE_OSD, i); }
+  static entity_name_t CLIENT(int64_t i=NEW) { return entity_name_t(TYPE_CLIENT, i); }
   
   int64_t num() const { return _num; }
   int type() const { return _type; }