From: Sage Weil Date: Tue, 12 Jun 2018 17:39:55 +0000 (-0500) Subject: mon/Session: inst -> name and addrs X-Git-Tag: v14.0.1~951^2~9 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=def2254aa81ebeb9b3f70bedb62cb1ac71e79b70;p=ceph-ci.git mon/Session: inst -> name and addrs Signed-off-by: Sage Weil --- diff --git a/src/mon/ConfigMonitor.cc b/src/mon/ConfigMonitor.cc index 74ed0ad1cee..972378d1155 100644 --- a/src/mon/ConfigMonitor.cc +++ b/src/mon/ConfigMonitor.cc @@ -747,8 +747,8 @@ bool ConfigMonitor::refresh_config(MonSession *s) } string device_class; - if (s->inst.name.is_osd()) { - const char *c = osdmap.crush->get_item_class(s->inst.name.num()); + if (s->name.is_osd()) { + const char *c = osdmap.crush->get_item_class(s->name.num()); if (c) { device_class = c; dout(10) << __func__ << " device_class " << device_class << dendl; @@ -779,7 +779,7 @@ bool ConfigMonitor::refresh_config(MonSession *s) bool ConfigMonitor::maybe_send_config(MonSession *s) { bool changed = refresh_config(s); - dout(10) << __func__ << " to " << s->inst << " " + dout(10) << __func__ << " to " << s->name << " " << (changed ? "(changed)" : "(unchanged)") << dendl; if (changed) { @@ -790,7 +790,7 @@ bool ConfigMonitor::maybe_send_config(MonSession *s) void ConfigMonitor::send_config(MonSession *s) { - dout(10) << __func__ << " to " << s->inst << dendl; + dout(10) << __func__ << " to " << s->name << dendl; auto m = new MConfig(s->last_config); s->con->send_message(m); } diff --git a/src/mon/LogMonitor.cc b/src/mon/LogMonitor.cc index 9ea21ebea01..9f270377d1e 100644 --- a/src/mon/LogMonitor.cc +++ b/src/mon/LogMonitor.cc @@ -583,7 +583,7 @@ void LogMonitor::check_sub(Subscription *s) version_t summary_version = summary.version; if (s->next > summary_version) { - dout(10) << __func__ << " client " << s->session->inst + dout(10) << __func__ << " client " << s->session->name << " requested version (" << s->next << ") is greater than ours (" << summary_version << "), which means we already sent him" << " everything we have." << dendl; @@ -600,7 +600,7 @@ void LogMonitor::check_sub(Subscription *s) _create_sub_incremental(mlog, sub_level, s->next); } - dout(1) << __func__ << " sending message to " << s->session->inst + dout(1) << __func__ << " sending message to " << s->session->name << " with " << mlog->entries.size() << " entries" << " (version " << mlog->version << ")" << dendl; diff --git a/src/mon/MDSMonitor.cc b/src/mon/MDSMonitor.cc index 6736c2e115a..58eb2cc9c00 100644 --- a/src/mon/MDSMonitor.cc +++ b/src/mon/MDSMonitor.cc @@ -1477,15 +1477,14 @@ void MDSMonitor::check_sub(Subscription *sub) return; } - const bool is_mds = sub->session->inst.name.is_mds(); + const bool is_mds = sub->session->name.is_mds(); mds_gid_t mds_gid = MDS_GID_NONE; fs_cluster_id_t fscid = FS_CLUSTER_ID_NONE; if (is_mds) { // What (if any) namespace are you assigned to? auto mds_info = fsmap.get_mds_info(); for (const auto &p : mds_info) { -#warning fixme - if (p.second.addrs.legacy_addr() == sub->session->inst.addr) { + if (p.second.addrs == sub->session->addrs) { mds_gid = p.first; fscid = fsmap.mds_roles.at(mds_gid); } @@ -1552,7 +1551,7 @@ void MDSMonitor::check_sub(Subscription *sub) assert(mds_map != nullptr); dout(10) << __func__ << " selected MDS map epoch " << mds_map->epoch << " for namespace " << fscid << " for subscriber " - << sub->session->inst.name << " who wants epoch " << sub->next << dendl; + << sub->session->name << " who wants epoch " << sub->next << dendl; if (sub->next > mds_map->epoch) { return; diff --git a/src/mon/Monitor.cc b/src/mon/Monitor.cc index 45a8ea4a9a1..12518f34c89 100644 --- a/src/mon/Monitor.cc +++ b/src/mon/Monitor.cc @@ -3086,7 +3086,7 @@ void Monitor::handle_command(MonOpRequestRef op) param_str_map, mon_cmd)) { dout(1) << __func__ << " access denied" << dendl; (cmd_is_rw ? audit_clog->info() : audit_clog->debug()) - << "from='" << session->inst << "' " + << "from='" << session->name << " " << session->addrs << "' " << "entity='" << session->entity_name << "' " << "cmd=" << m->cmd << ": access denied"; reply_command(op, -EACCES, "access denied", 0); @@ -3094,9 +3094,9 @@ void Monitor::handle_command(MonOpRequestRef op) } (cmd_is_rw ? audit_clog->info() : audit_clog->debug()) - << "from='" << session->inst << "' " - << "entity='" << session->entity_name << "' " - << "cmd=" << m->cmd << ": dispatch"; + << "from='" << session->name << " " << session->addrs << "' " + << "entity='" << session->entity_name << "' " + << "cmd=" << m->cmd << ": dispatch"; if (mon_cmd->is_mgr()) { const auto& hdr = m->get_header(); @@ -3717,7 +3717,8 @@ void Monitor::handle_forward(MonOpRequestRef op) assert(req != NULL); ConnectionRef c(new AnonConnection(cct)); - MonSession *s = new MonSession(req->get_source_inst(), + MonSession *s = new MonSession(req->get_source(), + req->get_source_addrs(), static_cast(c.get())); c->set_priv(RefCountedPtr{s, false}); c->set_peer_addr(m->client.addr); @@ -3902,7 +3903,7 @@ void Monitor::resend_routed_requests() void Monitor::remove_session(MonSession *s) { - dout(10) << "remove_session " << s << " " << s->inst + dout(10) << "remove_session " << s << " " << s->name << " " << s->addrs << " features 0x" << std::hex << s->con_features << std::dec << dendl; assert(s->con); assert(!s->closed); @@ -4032,7 +4033,9 @@ void Monitor::_ms_dispatch(Message *m) ConnectionRef con = m->get_connection(); { Mutex::Locker l(session_map_lock); - s = session_map.new_session(m->get_source_inst(), con.get()); + s = session_map.new_session(m->get_source(), + m->get_source_addrs(), + con.get()); } assert(s); con->set_priv(RefCountedPtr{s, false}); @@ -4052,7 +4055,7 @@ void Monitor::_ms_dispatch(Message *m) s->authenticated = true; } } else { - dout(20) << __func__ << " existing session " << s << " for " << s->inst + dout(20) << __func__ << " existing session " << s << " for " << s->name << dendl; } @@ -4925,7 +4928,7 @@ bool Monitor::ms_handle_reset(Connection *con) Mutex::Locker l(lock); - dout(10) << "reset/close on session " << s->inst << dendl; + dout(10) << "reset/close on session " << s->name << " " << s->addrs << dendl; if (!s->closed) { Mutex::Locker l(session_map_lock); remove_session(s); @@ -5410,7 +5413,7 @@ void Monitor::tick() ++p; // don't trim monitors - if (s->inst.name.is_mon()) + if (s->name.is_mon()) continue; if (s->session_timeout < now && s->con) { @@ -5419,12 +5422,13 @@ void Monitor::tick() s->session_timeout += g_conf->mon_session_timeout; } if (s->session_timeout < now) { - dout(10) << " trimming session " << s->con << " " << s->inst + dout(10) << " trimming session " << s->con << " " << s->name + << " " << s->addrs << " (timeout " << s->session_timeout << " < now " << now << ")" << dendl; } else if (out_for_too_long) { // boot the client Session because we've taken too long getting back in - dout(10) << " trimming session " << s->con << " " << s->inst + dout(10) << " trimming session " << s->con << " " << s->name << " because we've been out of quorum too long" << dendl; } else { continue; diff --git a/src/mon/Monitor.h b/src/mon/Monitor.h index d07612601a9..3d3a1df6655 100644 --- a/src/mon/Monitor.h +++ b/src/mon/Monitor.h @@ -834,7 +834,7 @@ public: // if client drops we may not have a session to draw information from. if (s) { - ss << "from='" << s->inst << "' " + ss << "from='" << s->name << " " << s->addrs << "' " << "entity='" << s->entity_name << "' "; } else { ss << "session dropped for command "; diff --git a/src/mon/OSDMonitor.cc b/src/mon/OSDMonitor.cc index fc6a3ccd12c..5ef6d7e0bb6 100644 --- a/src/mon/OSDMonitor.cc +++ b/src/mon/OSDMonitor.cc @@ -1503,7 +1503,8 @@ void OSDMonitor::share_map_with_random_osd() return; } - dout(10) << "committed, telling random " << s->inst << " all about it" << dendl; + dout(10) << "committed, telling random " << s->name + << " all about it" << dendl; // get feature of the peer // use quorum_con_features, if it's an anonymous connection. @@ -3448,7 +3449,7 @@ void OSDMonitor::send_incremental(epoch_t first, MonOpRequestRef req) { dout(5) << "send_incremental [" << first << ".." << osdmap.get_epoch() << "]" - << " to " << session->inst << dendl; + << " to " << session->name << dendl; // get feature of the peer // use quorum_con_features, if it's an anonymous connection. @@ -3456,7 +3457,7 @@ void OSDMonitor::send_incremental(epoch_t first, mon->get_quorum_con_features(); if (first <= session->osd_epoch) { - dout(10) << __func__ << " " << session->inst << " should already have epoch " + dout(10) << __func__ << " " << session->name << " should already have epoch " << session->osd_epoch << dendl; first = session->osd_epoch + 1; } @@ -3817,13 +3818,13 @@ void OSDMonitor::check_pg_creates_subs() void OSDMonitor::check_pg_creates_sub(Subscription *sub) { - dout(20) << __func__ << " .. " << sub->session->inst << dendl; + dout(20) << __func__ << " .. " << sub->session->name << dendl; assert(sub->type == "osd_pg_creates"); // only send these if the OSD is up. we will check_subs() when they do // come up so they will get the creates then. - if (sub->session->inst.name.is_osd() && - mon->osdmon()->osdmap.is_up(sub->session->inst.name.num())) { - sub->next = send_pg_creates(sub->session->inst.name.num(), + if (sub->session->name.is_osd() && + mon->osdmon()->osdmap.is_up(sub->session->name.num())) { + sub->next = send_pg_creates(sub->session->name.num(), sub->session->con.get(), sub->next); } diff --git a/src/mon/Session.h b/src/mon/Session.h index d17758b9089..6c97f686255 100644 --- a/src/mon/Session.h +++ b/src/mon/Session.h @@ -42,41 +42,38 @@ struct MonSession : public RefCountedObject { ConnectionRef con; int con_type = 0; uint64_t con_features = 0; // zero if AnonConnection - entity_inst_t inst; + entity_name_t name; + entity_addrvec_t addrs; utime_t session_timeout; - bool closed; + bool closed = false; xlist::item item; set routed_request_tids; MonCap caps; - uint64_t auid; - uint64_t global_id; + uint64_t auid = 0; + uint64_t global_id = 0; bool authenticated = false; ///< true if auth handshake is complete map sub_map; - epoch_t osd_epoch; // the osdmap epoch sent to the mon client + epoch_t osd_epoch = 0; ///< the osdmap epoch sent to the mon client - AuthServiceHandler *auth_handler; + AuthServiceHandler *auth_handler = nullptr; EntityName entity_name; ConnectionRef proxy_con; - uint64_t proxy_tid; + uint64_t proxy_tid = 0; string remote_host; ///< remote host name map last_config; ///< most recently shared config bool any_config = false; - MonSession(const entity_inst_t& i, Connection *c) : + MonSession(const entity_name_t& n, const entity_addrvec_t& av, Connection *c) : RefCountedObject(g_ceph_context), con(c), con_type(c->get_peer_type()), - con_features(0), - inst(i), closed(false), item(this), - auid(0), - global_id(0), - osd_epoch(0), - auth_handler(NULL), - proxy_con(NULL), proxy_tid(0) { + name(n), + addrs(av), + item(this) { if (c->get_messenger()) { // only fill in features if this is a non-anonymous connection con_features = c->get_features(); @@ -129,9 +126,9 @@ struct MonSessionMap { } s->sub_map.clear(); s->item.remove_myself(); - if (s->inst.name.is_osd()) { - for (multimap::iterator p = by_osd.find(s->inst.name.num()); - p->first == s->inst.name.num(); + if (s->name.is_osd()) { + for (multimap::iterator p = by_osd.find(s->name.num()); + p->first == s->name.num(); ++p) if (p->second == s) { by_osd.erase(p); @@ -145,12 +142,14 @@ struct MonSessionMap { s->put(); } - MonSession *new_session(const entity_inst_t& i, Connection *c) { - MonSession *s = new MonSession(i, c); + MonSession *new_session(const entity_name_t& n, + const entity_addrvec_t& av, + Connection *c) { + MonSession *s = new MonSession(n, av, c); assert(s); sessions.push_back(&s->item); - if (i.name.is_osd()) - by_osd.insert(pair(i.name.num(), s)); + if (n.is_osd()) + by_osd.insert(pair(n.num(), s)); if (s->con_features) { feature_map.add(s->con_type, s->con_features); } @@ -229,8 +228,10 @@ struct MonSessionMap { inline ostream& operator<<(ostream& out, const MonSession& s) { - out << "MonSession(" << s.inst << " is " << (s.closed ? "closed" : "open") - << " " << s.caps << ", features 0x" << std::hex << s.con_features << std::dec + out << "MonSession(" << s.name << " " << s.addrs + << " is " << (s.closed ? "closed" : "open") + << " " << s.caps + << ", features 0x" << std::hex << s.con_features << std::dec << " (" << ceph_release_name(ceph_release_from_features(s.con_features)) << "))"; return out;