From 37edd162a8743d5663fcbf1c480bc8456378cda9 Mon Sep 17 00:00:00 2001 From: Henry Chang Date: Wed, 22 Apr 2015 11:52:18 +0800 Subject: [PATCH] mds: fix integer truncation Client ID is a 64-bit integer. Unlike Ceph daemons, it may go beyond 2147483647 and cause problems. Signed-off-by: Henry Chang --- src/mds/Server.cc | 2 +- src/msg/msg_types.h | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/mds/Server.cc b/src/mds/Server.cc index db6b8e9adc4..a73843c5395 100644 --- a/src/mds/Server.cc +++ b/src/mds/Server.cc @@ -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); diff --git a/src/msg/msg_types.h b/src/msg/msg_types.h index 9c0f266d2b4..4f4629b2d67 100644 --- a/src/msg/msg_types.h +++ b/src/msg/msg_types.h @@ -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; }