From c507e3c988223e9554471a5b470d61d8cbef3f3a Mon Sep 17 00:00:00 2001 From: Sage Weil Date: Mon, 9 Nov 2009 15:38:56 -0800 Subject: [PATCH] auth: kill ClientMOnitor, MCLientMOunt*, etc. --- src/Makefile.am | 5 - src/ceph.cc | 11 -- src/client/Client.cc | 7 +- src/include/ceph_fs.h | 2 - src/librados.cc | 11 +- src/messages/MClientMount.h | 35 ---- src/messages/MClientMountAck.h | 54 ------ src/mon/ClientMap.h | 54 ------ src/mon/ClientMonitor.cc | 301 --------------------------------- src/mon/ClientMonitor.h | 95 ----------- src/mon/MonCaps.cc | 2 - src/mon/MonClient.cc | 99 ++--------- src/mon/MonClient.h | 18 +- src/mon/Monitor.cc | 16 +- src/mon/Monitor.h | 2 - src/mon/mon_types.h | 12 +- src/msg/Message.cc | 8 - 17 files changed, 33 insertions(+), 699 deletions(-) delete mode 100644 src/messages/MClientMount.h delete mode 100644 src/messages/MClientMountAck.h delete mode 100644 src/mon/ClientMap.h delete mode 100644 src/mon/ClientMonitor.cc delete mode 100644 src/mon/ClientMonitor.h diff --git a/src/Makefile.am b/src/Makefile.am index a7c25a08a5532..2385d83a111fa 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -345,7 +345,6 @@ libmon_a_SOURCES = \ mon/OSDMonitor.cc \ mon/MDSMonitor.cc \ mon/MonmapMonitor.cc \ - mon/ClientMonitor.cc \ mon/PGMonitor.cc \ mon/LogMonitor.cc \ mon/ClassMonitor.cc \ @@ -564,8 +563,6 @@ noinst_HEADERS = \ messages/MClientCaps.h\ messages/MClientCapRelease.h\ messages/MClientLease.h\ - messages/MClientMount.h\ - messages/MClientMountAck.h\ messages/MClientReconnect.h\ messages/MClientReply.h\ messages/MClientRequest.h\ @@ -649,8 +646,6 @@ noinst_HEADERS = \ messages/MStatfsReply.h\ messages/PaxosServiceMessage.h\ mon/ClassMonitor.h\ - mon/ClientMap.h\ - mon/ClientMonitor.h\ mon/Elector.h\ mon/LogMonitor.h\ mon/MDSMonitor.h\ diff --git a/src/ceph.cc b/src/ceph.cc index 8ac8d8d617a66..734154bd9efe1 100644 --- a/src/ceph.cc +++ b/src/ceph.cc @@ -67,9 +67,7 @@ Context *resend_event = 0; // observe (push) -#include "mon/ClientMap.h" #include "mon/PGMap.h" -#include "mon/ClientMap.h" #include "osd/OSDMap.h" #include "mds/MDSMap.h" #include "include/LogEntry.h" @@ -84,7 +82,6 @@ int observe = 0; static PGMap pgmap; static MDSMap mdsmap; static OSDMap osdmap; -static ClientMap clientmap; static set registered; @@ -149,14 +146,6 @@ void handle_notify(MMonObserveNotify *notify) } break; - case PAXOS_CLIENTMAP: - { - bufferlist::iterator p = notify->bl.begin(); - clientmap.decode(p); - dout(0) << "client " << clientmap << dendl; - } - break; - case PAXOS_LOG: { bufferlist::iterator p = notify->bl.begin(); diff --git a/src/client/Client.cc b/src/client/Client.cc index beda87be2016a..273855de2d46f 100644 --- a/src/client/Client.cc +++ b/src/client/Client.cc @@ -35,8 +35,6 @@ using namespace std; #include "messages/MMonMap.h" -#include "messages/MClientMount.h" -#include "messages/MClientMountAck.h" #include "messages/MClientSession.h" #include "messages/MClientReconnect.h" #include "messages/MClientRequest.h" @@ -2719,11 +2717,14 @@ int Client::mount() } client_lock.Unlock(); - int r = monclient->mount(g_conf.client_mount_timeout); + int r = monclient->authenticate(g_conf.client_mount_timeout); client_lock.Lock(); if (r < 0) return r; + whoami = monclient->get_global_id(); + messenger->set_myname(entity_name_t::CLIENT(whoami.v)); + whoami = messenger->get_myname().num(); objecter->init(); diff --git a/src/include/ceph_fs.h b/src/include/ceph_fs.h index 7113d23e3f07b..94642d1027e26 100644 --- a/src/include/ceph_fs.h +++ b/src/include/ceph_fs.h @@ -102,8 +102,6 @@ int ceph_file_layout_is_valid(const struct ceph_file_layout *layout); /* client <-> monitor */ #define CEPH_MSG_MON_MAP 4 #define CEPH_MSG_MON_GET_MAP 5 -#define CEPH_MSG_CLIENT_MOUNT 10 -#define CEPH_MSG_CLIENT_MOUNT_ACK 11 #define CEPH_MSG_STATFS 13 #define CEPH_MSG_STATFS_REPLY 14 #define CEPH_MSG_MON_SUBSCRIBE 15 diff --git a/src/librados.cc b/src/librados.cc index 2167a77eeb70b..340e4438e0bfb 100644 --- a/src/librados.cc +++ b/src/librados.cc @@ -37,9 +37,6 @@ using namespace std; #include "osdc/Objecter.h" -#include "messages/MClientMount.h" -#include "messages/MClientMountAck.h" - #include "include/librados.h" #define RADOS_LIST_MAX_ENTRIES 1024 @@ -314,13 +311,7 @@ bool RadosClient::init() dout(1) << "iit" << dendl; monclient.init(); - if (monclient.get_monmap() < 0) - return false; - - monclient.wait_authenticate(30.0); - - monclient.mount(g_conf.client_mount_timeout); - + monclient.authenticate(g_conf.client_mount_timeout); lock.Lock(); diff --git a/src/messages/MClientMount.h b/src/messages/MClientMount.h deleted file mode 100644 index dbd8d40ce9988..0000000000000 --- a/src/messages/MClientMount.h +++ /dev/null @@ -1,35 +0,0 @@ -// -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*- -// vim: ts=8 sw=2 smarttab -/* - * Ceph - scalable distributed file system - * - * Copyright (C) 2004-2006 Sage Weil - * - * This is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License version 2.1, as published by the Free Software - * Foundation. See file COPYING. - * - */ - -#ifndef __MCLIENTMOUNT_H -#define __MCLIENTMOUNT_H - -#include "messages/PaxosServiceMessage.h" - -class MClientMount : public PaxosServiceMessage { -public: - MClientMount() : PaxosServiceMessage(CEPH_MSG_CLIENT_MOUNT, 0) { } - - const char *get_type_name() { return "client_mount"; } - - void decode_payload() { - bufferlist::iterator p = payload.begin(); - paxos_decode(p); - } - void encode_payload() { - paxos_encode(); - } -}; - -#endif diff --git a/src/messages/MClientMountAck.h b/src/messages/MClientMountAck.h deleted file mode 100644 index eeca95351be27..0000000000000 --- a/src/messages/MClientMountAck.h +++ /dev/null @@ -1,54 +0,0 @@ -// -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*- -// vim: ts=8 sw=2 smarttab -/* - * Ceph - scalable distributed file system - * - * Copyright (C) 2004-2006 Sage Weil - * - * This is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License version 2.1, as published by the Free Software - * Foundation. See file COPYING. - * - */ - -#ifndef __MCLIENTMOUNTACK_H -#define __MCLIENTMOUNTACK_H - -#include "msg/Message.h" - -struct MClientMountAck : public Message { - client_t client; - __s32 result; - cstring result_msg; - bufferlist monmap_bl; - - MClientMountAck(client_t c = -1, int r = 0, const char *msg = 0) : - Message(CEPH_MSG_CLIENT_MOUNT_ACK), - client(c), result(r), - result_msg(msg) { } - - const char *get_type_name() { return "client_mount_ack"; } - void print(ostream& o) { - o << "client_mount_ack(client" << client << " " << result; - if (result_msg.length()) o << " " << result_msg; - if (monmap_bl.length()) o << " + monmap"; - o << ")"; - } - - void decode_payload() { - bufferlist::iterator p = payload.begin(); - ::decode(client, p); - ::decode(result, p); - ::decode(result_msg, p); - ::decode(monmap_bl, p); - } - void encode_payload() { - ::encode(client, payload); - ::encode(result, payload); - ::encode(result_msg, payload); - ::encode(monmap_bl, payload); - } -}; - -#endif diff --git a/src/mon/ClientMap.h b/src/mon/ClientMap.h deleted file mode 100644 index 0c59c6825d3da..0000000000000 --- a/src/mon/ClientMap.h +++ /dev/null @@ -1,54 +0,0 @@ -// -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*- -// vim: ts=8 sw=2 smarttab -/* - * Ceph - scalable distributed file system - * - * Copyright (C) 2004-2006 Sage Weil - * - * This is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License version 2.1, as published by the Free Software - * Foundation. See file COPYING. - * - */ - -/* - * The Client Monitor is used for traking the filesystem's clients. - */ - -#ifndef __CLIENTMAP_H -#define __CLIENTMAP_H - -#include -#include -using namespace std; - -#include "include/types.h" - -class ClientMap { -public: - version_t version; - client_t next_client; - - ClientMap() : version(0), next_client(0) {} - - void encode(bufferlist &bl) const { - ::encode(version, bl); - ::encode(next_client, bl); - } - void decode(bufferlist::iterator &bl) { - ::decode(version, bl); - ::decode(next_client, bl); - } - - void print_summary(ostream& out) { - out << "v" << version << ": next is " << next_client; - } -}; - -inline ostream& operator<<(ostream& out, ClientMap& cm) { - cm.print_summary(out); - return out; -} - -#endif diff --git a/src/mon/ClientMonitor.cc b/src/mon/ClientMonitor.cc deleted file mode 100644 index b365dd210eee2..0000000000000 --- a/src/mon/ClientMonitor.cc +++ /dev/null @@ -1,301 +0,0 @@ -// -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*- -// vim: ts=8 sw=2 smarttab -/* - * Ceph - scalable distributed file system - * - * Copyright (C) 2004-2006 Sage Weil - * - * This is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License version 2.1, as published by the Free Software - * Foundation. See file COPYING. - * - */ - - -#include "ClientMonitor.h" -#include "Monitor.h" -#include "MDSMonitor.h" -#include "OSDMonitor.h" -#include "MonitorStore.h" - -#include "messages/MMonMap.h" -#include "messages/MClientMount.h" -#include "messages/MClientMountAck.h" -#include "messages/MMonCommand.h" - -#include "common/Timer.h" - -#include "auth/ExportControl.h" - -#include - -#include "config.h" - -#define DOUT_SUBSYS mon -#undef dout_prefix -#define dout_prefix _prefix(mon, client_map) -static ostream& _prefix(Monitor *mon, ClientMap& client_map) { - return *_dout << dbeginl - << "mon" << mon->whoami - << (mon->is_starting() ? (const char*)"(starting)":(mon->is_leader() ? (const char*)"(leader)":(mon->is_peon() ? (const char*)"(peon)":(const char*)"(?\?)"))) - << ".client v" << client_map.version << " "; -} - - -bool ClientMonitor::update_from_paxos() -{ - version_t paxosv = paxos->get_version(); - if (paxosv == client_map.version) return true; - assert(paxosv >= client_map.version); - - dout(10) << "update_from_paxos paxosv " << paxosv - << ", my v " << client_map.version << dendl; - - bufferlist bl; - bool success = paxos->read(paxosv, bl); - assert(success); - - bufferlist::iterator p = bl.begin(); - client_map.decode(p); - - assert(paxosv == client_map.version); - - paxos->stash_latest(paxosv, bl); - - if (next_client < 0) { - dout(10) << "in-core next_client reset to " << client_map.next_client << dendl; - next_client = client_map.next_client; - } - - return true; -} - -void ClientMonitor::on_election_start() -{ - dout(10) << "in-core next_client reset to " << client_map.next_client << dendl; - next_client = client_map.next_client; -} - -void ClientMonitor::create_pending() -{ - pending_map = client_map; - pending_map.version = client_map.version + 1; - dout(10) << "create_pending" << dendl; -} - -void ClientMonitor::create_initial(bufferlist& bl) -{ - dout(10) << "create_initial -- creating initial map" << dendl; -} - -void ClientMonitor::committed() -{ - -} - - -void ClientMonitor::encode_pending(bufferlist &bl) -{ - dout(10) << "encode_pending v " << pending_map.version - << ", next is " << pending_map.next_client - << dendl; - assert(paxos->get_version() + 1 == pending_map.version); - pending_map.encode(bl); -} - - -// ------- - -bool ClientMonitor::preprocess_query(PaxosServiceMessage *m) -{ - dout(10) << "preprocess_query " << *m << " from " << m->get_orig_source_inst() << dendl; - - switch (m->get_type()) { - case CEPH_MSG_CLIENT_MOUNT: - return preprocess_mount((MClientMount *)m); - - case MSG_MON_COMMAND: - return preprocess_command((MMonCommand*)m); - - default: - assert(0); - delete m; - return true; - } -} - -bool ClientMonitor::prepare_update(PaxosServiceMessage *m) -{ - stringstream ss; - dout(10) << "prepare_update " << *m << " from " << m->get_orig_source_inst() << dendl; - - switch (m->get_type()) { - case CEPH_MSG_CLIENT_MOUNT: - return prepare_mount((MClientMount*)m); - - case MSG_MON_COMMAND: - return prepare_command((MMonCommand*)m); - - default: - assert(0); - delete m; - return false; - } - -} - - -// MOUNT - -bool ClientMonitor::preprocess_mount(MClientMount *m) -{ - stringstream ss; - - // allowed? - entity_addr_t addr = m->get_orig_source_addr(); - ExportControl *ec = conf_get_export_control(); - if (ec && (!ec->is_authorized(&addr, "/"))) { - dout(0) << "client is not authorized to mount" << dendl; - ss << "client " << addr << " is not authorized to mount"; - mon->get_logclient()->log(LOG_SEC, ss); - - string s; - getline(ss, s); - mon->send_reply(m, new MClientMountAck(-1, -EPERM, s.c_str())); - delete m; - return true; - } - - // fast mount? - if (mon->is_leader() && - next_client < client_map.next_client) { - client_t client = next_client; - next_client.v++; - - dout(10) << "preprocess_mount fast mount client" << client << ", in-core next is " << next_client - << ", paxos next is " << pending_map.next_client << dendl; - _mounted(client, m); - - if (next_client == pending_map.next_client) { - pending_map.next_client.v += g_conf.mon_clientid_prealloc; - propose_pending(); - } - - return true; - } - - return false; -} - -bool ClientMonitor::prepare_mount(MClientMount *m) -{ - entity_addr_t addr = m->get_orig_source_addr(); - - assert(next_client <= client_map.next_client); - - client_t client = next_client; - next_client.v++; - - pending_map.next_client.v = next_client.v + g_conf.mon_clientid_prealloc; - - dout(10) << "mount: assigned client" << client << " to " << addr << dendl; - - paxos->wait_for_commit(new C_Mounted(this, client, (MClientMount*)m)); - return true; -} - -void ClientMonitor::_mounted(client_t client, MClientMount *m) -{ - entity_inst_t to; - to.addr = m->get_orig_source_addr(); - to.name = entity_name_t::CLIENT(client.v); - - dout(10) << "_mounted client" << client << " at " << to << dendl; - - stringstream ss; - ss << "client" << client << " " << to.addr; - mon->get_logclient()->log(LOG_INFO, ss); - - // reply with client ticket - MClientMountAck *ack = new MClientMountAck; - ack->client = client; - mon->monmap->encode(ack->monmap_bl); - - mon->send_reply(m, ack, to); - delete m; -} - - -// COMMAND - -bool ClientMonitor::preprocess_command(MMonCommand *m) -{ - int r = -1; - bufferlist rdata; - stringstream ss; - - if (m->cmd.size() > 1) { - if (m->cmd[1] == "stat") { - ss << client_map; - r = 0; - } - else if (m->cmd[1] == "getmap") { - client_map.encode(rdata); - ss << "got clientmap version " << client_map.version; - r = 0; - } - else if (m->cmd[1] == "dump") { - ss << "version " << client_map.version << std::endl; - ss << "next_client " << client_map.next_client << std::endl; - while (!ss.eof()) { - string s; - getline(ss, s); - rdata.append(s.c_str(), s.length()); - rdata.append("\n", 1); - } - ss << "ok"; - r = 0; - } - } - - if (r != -1) { - string rs; - getline(ss, rs); - mon->reply_command(m, r, rs, rdata, paxos->get_version()); - return true; - } else - return false; -} - - -bool ClientMonitor::prepare_command(MMonCommand *m) -{ - stringstream ss; - string rs; - int err = -EINVAL; - - // nothing here yet - ss << "unrecognized command"; - - getline(ss, rs); - mon->reply_command(m, err, rs, paxos->get_version()); - return false; -} - -bool ClientMonitor::should_propose(double& delay) -{ - return true; // never delay! we want fast mounts! -} - -void ClientMonitor::tick() -{ - if (!paxos->is_active()) return; - - update_from_paxos(); - dout(10) << client_map << dendl; - - if (!mon->is_leader()) return; - - // ... -} diff --git a/src/mon/ClientMonitor.h b/src/mon/ClientMonitor.h deleted file mode 100644 index adbcbd59b6b8b..0000000000000 --- a/src/mon/ClientMonitor.h +++ /dev/null @@ -1,95 +0,0 @@ -// -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*- -// vim: ts=8 sw=2 smarttab -/* - * Ceph - scalable distributed file system - * - * Copyright (C) 2004-2006 Sage Weil - * - * This is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License version 2.1, as published by the Free Software - * Foundation. See file COPYING. - * - */ - -/* - * The Client Monitor is used for traking the filesystem's clients. - */ - -#ifndef __CLIENTMONITOR_H -#define __CLIENTMONITOR_H - -#include -#include -using namespace std; - -#include "include/types.h" -#include "msg/Messenger.h" - -#include "mds/MDSMap.h" - -#include "PaxosService.h" -#include "ClientMap.h" - -class Monitor; -class Paxos; -class MAuth; -class MClientMount; -class MClientUnmount; -class MMonCommand; -class ClientAuthManager; - - -class ClientMonitor : public PaxosService { -public: - - class C_Mounted : public Context { - ClientMonitor *cmon; - client_t client; - MClientMount *m; - public: - C_Mounted(ClientMonitor *cm, client_t c, MClientMount *m_) : - cmon(cm), client(c), m(m_) {} - void finish(int r) { - if (r >= 0) - cmon->_mounted(client, m); - else - cmon->dispatch((PaxosServiceMessage*)m); - } - }; - - ClientMap client_map, pending_map; - client_t next_client; - -private: - // leader - - void create_initial(bufferlist& bl); - bool update_from_paxos(); - void create_pending(); // prepare a new pending - void encode_pending(bufferlist &bl); // propose pending update to peers - - void committed(); - - bool preprocess_mount(MClientMount *m); - bool prepare_mount(MClientMount *m); - void _mounted(client_t c, MClientMount *m); - - bool preprocess_query(PaxosServiceMessage *m); // true if processed. - bool prepare_update(PaxosServiceMessage *m); - - bool preprocess_command(MMonCommand *m); // true if processed. - bool prepare_command(MMonCommand *m); - - bool should_propose(double& delay); - - void on_election_start(); - - public: - ClientMonitor(Monitor *mn, Paxos *p) : PaxosService(mn, p), next_client(-1) { } - - void tick(); // check state, take actions - -}; - -#endif diff --git a/src/mon/MonCaps.cc b/src/mon/MonCaps.cc index 99f8e2bf43bef..ae677a5be3217 100644 --- a/src/mon/MonCaps.cc +++ b/src/mon/MonCaps.cc @@ -70,8 +70,6 @@ int MonCaps::get_service_id(string& token) return PAXOS_MONMAP; } else if (token.compare("osdmap") == 0) { return PAXOS_OSDMAP; - } else if (token.compare("clientmap") == 0) { - return PAXOS_CLIENTMAP; } else if (token.compare("log") == 0) { return PAXOS_LOG; } else if (token.compare("class") == 0) { diff --git a/src/mon/MonClient.cc b/src/mon/MonClient.cc index 7626b14eb0f10..7a99f4d702f62 100644 --- a/src/mon/MonClient.cc +++ b/src/mon/MonClient.cc @@ -15,13 +15,11 @@ #include "msg/SimpleMessenger.h" #include "messages/MMonGetMap.h" #include "messages/MMonMap.h" -#include "messages/MClientMount.h" #include "messages/MAuth.h" #include "messages/MAuthReply.h" #include "include/nstring.h" -#include "messages/MClientMountAck.h" #include "messages/MMonSubscribe.h" #include "messages/MMonSubscribeAck.h" #include "common/ConfUtils.h" @@ -188,10 +186,6 @@ bool MonClient::ms_dispatch(Message *m) handle_monmap((MMonMap*)m); return true; - case CEPH_MSG_CLIENT_MOUNT_ACK: - handle_mount_ack((MClientMountAck*)m); - return true; - case CEPH_MSG_AUTH_REPLY: handle_auth((MAuthReply*)m); return true; @@ -225,14 +219,6 @@ void MonClient::handle_monmap(MMonMap *m) } // ---------------------- -// mount - -void MonClient::_send_mount() -{ - dout(10) << "_send_mount" << dendl; - _send_mon_message(new MClientMount); - mount_started = g_clock.now(); -} void MonClient::init() { @@ -267,54 +253,26 @@ void MonClient::shutdown() timer.cancel_all_events(); } -int MonClient::mount(double mount_timeout) +int MonClient::authenticate(double timeout) { Mutex::Locker lock(monc_lock); if (clientid >= 0) { - dout(5) << "already mounted" << dendl;; + dout(5) << "already authenticated" << dendl;; return 0; } - // only first mounter does the work _sub_want("monmap", monmap.get_epoch()); - mounting++; - if (mounting == 1) { - if (cur_mon < 0) - _reopen_session(); - else - _send_mount(); - } - while (clientid < 0 && !mount_err) - mount_cond.Wait(monc_lock); - mounting--; - - if (clientid >= 0) - dout(5) << "mount success, client" << clientid << dendl; - - return mount_err; -} - -void MonClient::handle_mount_ack(MClientMountAck* m) -{ - dout(10) << "handle_mount_ack " << *m << dendl; - - _finish_hunting(); + if (cur_mon < 0) + _reopen_session(); - if (m->result) { - mount_err = m->result; - dout(0) << "mount error " << m->result << " (" << m->result_msg << ")" << dendl; - } else { - // monmap - bufferlist::iterator p = m->monmap_bl.begin(); - ::decode(monmap, p); + while (clientid < 0 && !authenticate_err) + authenticate_cond.Wait(monc_lock); - clientid = m->client; - messenger->set_myname(entity_name_t::CLIENT(m->client.v)); - } + if (clientid >= 0) + dout(5) << "authenticate success, client" << clientid << dendl; - mount_cond.SignalAll(); - delete m; + return authenticate_err; } void MonClient::handle_auth(MAuthReply *m) @@ -335,8 +293,9 @@ void MonClient::handle_auth(MAuthReply *m) } try { ::decode(global_id, p); + clientid = global_id; auth->set_global_id(global_id); - dout(0) << "decoded global_id=" << global_id << dendl; + dout(1) << "my global_id is " << global_id << dendl; } catch (buffer::error *err) { delete m; return; @@ -356,6 +315,9 @@ void MonClient::handle_auth(MAuthReply *m) return; } + _finish_hunting(); + + authenticate_err = ret; if (ret == 0) { if (state != MC_STATE_HAVE_SESSION) { state = MC_STATE_HAVE_SESSION; @@ -367,35 +329,8 @@ void MonClient::handle_auth(MAuthReply *m) } _check_auth_rotating(); - - auth_cond.SignalAll(); - } - - /* - switch (state) { - case MC_STATE_AUTHENTICATING: - { - dout(0) << "done authenticating" << dendl; - state = MC_STATE_AUTHENTICATED; - auth.send_session_request(this, &authorize_handler); - } - break; - case MC_STATE_AUTHENTICATED: - { - dout(0) << "done authorizing" << dendl; - state = MC_STATE_HAVE_SESSION; - while (!waiting_for_session.empty()) { - _send_mon_message(waiting_for_session.front()); - waiting_for_session.pop_front(); - } - authenticate_cond.SignalAll(); - } - break; - default: - assert(false); - } } - */ + auth_cond.SignalAll(); } @@ -442,12 +377,8 @@ void MonClient::_reopen_session() _send_mon_message(m, true); } - if (mounting) - _send_mount(); if (!sub_have.empty()) _renew_subs(); - if (!mounting && sub_have.empty()) - _send_mon_message(new MMonGetMap); } diff --git a/src/mon/MonClient.h b/src/mon/MonClient.h index e2e8df6a7f617..369ee193c8932 100644 --- a/src/mon/MonClient.h +++ b/src/mon/MonClient.h @@ -28,7 +28,6 @@ class MonMap; class MMonMap; -class MClientMountAck; class MMonSubscribeAck; class MAuthReply; class MAuthRotating; @@ -91,14 +90,12 @@ private: uint64_t global_id; - // mount + // authenticate private: client_t clientid; - int mounting; - int mount_err; - Cond mount_cond, map_cond; + Cond map_cond; Cond authenticate_cond; - utime_t mount_started; + int authenticate_err; list waiting_for_session; @@ -106,8 +103,6 @@ private: void _reopen_session(); void _pick_new_mon(); void _send_mon_message(Message *m, bool force=false); - void _send_mount(); - void handle_mount_ack(MClientMountAck* m); public: void set_entity_name(EntityName name) { entity_name = name; } @@ -115,8 +110,7 @@ public: int _check_auth_rotating(); int wait_auth_rotating(double timeout); - int mount(double mount_timeout); - + int authenticate(double timeout); int wait_authenticate(double timeout); // mon subscriptions @@ -178,7 +172,7 @@ public: hunting(false), want_monmap(false), want_keys(0), global_id(0), - mounting(0), mount_err(0), + authenticate_err(0), auth(NULL) { } ~MonClient() { timer.cancel_all_events(); @@ -223,6 +217,8 @@ public: return monmap.size(); } + client_t get_global_id() { return clientid; } + void set_messenger(Messenger *m) { messenger = m; } void send_auth_message(Message *m) { diff --git a/src/mon/Monitor.cc b/src/mon/Monitor.cc index c96bf0eaeb0bc..a9dd2b3634f81 100644 --- a/src/mon/Monitor.cc +++ b/src/mon/Monitor.cc @@ -35,8 +35,6 @@ #include "messages/MClass.h" #include "messages/MRoute.h" -#include "messages/MClientMountAck.h" - #include "messages/MMonSubscribe.h" #include "messages/MMonSubscribeAck.h" @@ -48,7 +46,6 @@ #include "OSDMonitor.h" #include "MDSMonitor.h" #include "MonmapMonitor.h" -#include "ClientMonitor.h" #include "PGMonitor.h" #include "LogMonitor.h" #include "ClassMonitor.h" @@ -94,7 +91,6 @@ Monitor::Monitor(int w, MonitorStore *s, Messenger *m, MonMap *map) : paxos_service[PAXOS_MDSMAP] = new MDSMonitor(this, add_paxos(PAXOS_MDSMAP)); paxos_service[PAXOS_MONMAP] = new MonmapMonitor(this, add_paxos(PAXOS_MONMAP)); paxos_service[PAXOS_OSDMAP] = new OSDMonitor(this, add_paxos(PAXOS_OSDMAP)); - paxos_service[PAXOS_CLIENTMAP] = new ClientMonitor(this, add_paxos(PAXOS_CLIENTMAP)); paxos_service[PAXOS_PGMAP] = new PGMonitor(this, add_paxos(PAXOS_PGMAP)); paxos_service[PAXOS_LOG] = new LogMonitor(this, add_paxos(PAXOS_LOG)); paxos_service[PAXOS_CLASS] = new ClassMonitor(this, add_paxos(PAXOS_CLASS)); @@ -259,10 +255,6 @@ void Monitor::handle_command(MMonCommand *m) pgmon()->dispatch(m); return; } - if (m->cmd[0] == "client") { - clientmon()->dispatch(m); - return; - } if (m->cmd[0] == "mon") { monmon()->dispatch(m); return; @@ -607,17 +599,11 @@ do { \ paxos_service[PAXOS_AUTH]->dispatch((PaxosServiceMessage*)m); break; - // clients - case CEPH_MSG_CLIENT_MOUNT: - ALLOW_CAPS(PAXOS_CLIENTMAP, MON_CAP_RW); - paxos_service[PAXOS_CLIENTMAP]->dispatch((PaxosServiceMessage*)m); - break; - // pg case CEPH_MSG_STATFS: case MSG_PGSTATS: case MSG_GETPOOLSTATS: - ALLOW_CAPS(PAXOS_CLIENTMAP, MON_CAP_R); + ALLOW_CAPS(PAXOS_PGMAP, MON_CAP_R); paxos_service[PAXOS_PGMAP]->dispatch((PaxosServiceMessage*)m); break; diff --git a/src/mon/Monitor.h b/src/mon/Monitor.h index 4cf4516715417..073aa0de13e27 100644 --- a/src/mon/Monitor.h +++ b/src/mon/Monitor.h @@ -125,7 +125,6 @@ public: class MDSMonitor *mdsmon() { return (class MDSMonitor *)paxos_service[PAXOS_MDSMAP]; } class MonmapMonitor *monmon() { return (class MonmapMonitor *)paxos_service[PAXOS_MONMAP]; } class OSDMonitor *osdmon() { return (class OSDMonitor *)paxos_service[PAXOS_OSDMAP]; } - class ClientMonitor *clientmon() { return (class ClientMonitor *)paxos_service[PAXOS_CLIENTMAP]; } class ClassMonitor *classmon() { return (class ClassMonitor *)paxos_service[PAXOS_CLASS]; } class AuthMonitor *authmon() { return (class AuthMonitor *)paxos_service[PAXOS_AUTH]; } @@ -133,7 +132,6 @@ public: friend class OSDMonitor; friend class MDSMonitor; friend class MonmapMonitor; - friend class ClientMonitor; friend class PGMonitor; friend class LogMonitor; diff --git a/src/mon/mon_types.h b/src/mon/mon_types.h index be447f59a3265..a972dffdb2324 100644 --- a/src/mon/mon_types.h +++ b/src/mon/mon_types.h @@ -18,19 +18,17 @@ #define PAXOS_PGMAP 0 // before osd, for pg kick to behave #define PAXOS_MDSMAP 1 #define PAXOS_OSDMAP 2 -#define PAXOS_CLIENTMAP 3 -#define PAXOS_LOG 4 -#define PAXOS_CLASS 5 -#define PAXOS_MONMAP 6 -#define PAXOS_AUTH 7 -#define PAXOS_NUM 8 +#define PAXOS_LOG 3 +#define PAXOS_CLASS 4 +#define PAXOS_MONMAP 5 +#define PAXOS_AUTH 6 +#define PAXOS_NUM 7 inline const char *get_paxos_name(int p) { switch (p) { case PAXOS_MDSMAP: return "mdsmap"; case PAXOS_MONMAP: return "monmap"; case PAXOS_OSDMAP: return "osdmap"; - case PAXOS_CLIENTMAP: return "clientmap"; case PAXOS_PGMAP: return "pgmap"; case PAXOS_LOG: return "logm"; case PAXOS_CLASS: return "class"; diff --git a/src/msg/Message.cc b/src/msg/Message.cc index f10b48e3d3a02..309f17eb9b7fc 100644 --- a/src/msg/Message.cc +++ b/src/msg/Message.cc @@ -66,8 +66,6 @@ using namespace std; #include "messages/MAuth.h" #include "messages/MAuthReply.h" -#include "messages/MClientMount.h" -#include "messages/MClientMountAck.h" #include "messages/MMonSubscribe.h" #include "messages/MMonSubscribeAck.h" #include "messages/MMonGlobalID.h" @@ -332,12 +330,6 @@ Message *decode_message(ceph_msg_header& header, ceph_msg_footer& footer, break; // clients - case CEPH_MSG_CLIENT_MOUNT: - m = new MClientMount; - break; - case CEPH_MSG_CLIENT_MOUNT_ACK: - m = new MClientMountAck; - break; case CEPH_MSG_MON_SUBSCRIBE: m = new MMonSubscribe; break; -- 2.39.5