| 18053 | } |
| 18054 | |
| 18055 | void Client::ms_handle_remote_reset(Connection *con) |
| 18056 | { |
| 18057 | ldout(cct, 0) << __func__ << " on " << con->get_peer_addr() << dendl; |
| 18058 | |
| 18059 | cancel_commands_if([=, this](MDSCommandOp const& op) { |
| 18060 | if (op.one_shot && op.con.get() == con) { |
| 18061 | ldout(cct, 1) << "ms_handle_remote_reset: aborting one-shot command op " << op.tid << dendl; |
| 18062 | if (op.outs) { |
| 18063 | std::ostringstream ss; |
| 18064 | ss << "MDS remote session reset"; |
| 18065 | *(op.outs) = ss.str(); |
| 18066 | } |
| 18067 | return -EPIPE; |
| 18068 | } |
| 18069 | return 0; |
| 18070 | }); |
| 18071 | |
| 18072 | std::scoped_lock lock(client_lock); |
| 18073 | switch (con->get_peer_type()) { |
| 18074 | case CEPH_ENTITY_TYPE_MDS: |
| 18075 | { |
| 18076 | // kludge to figure out which mds this is; fixme with a Connection* state |
| 18077 | mds_rank_t mds = MDS_RANK_NONE; |
| 18078 | MetaSessionRef s = NULL; |
| 18079 | for (auto &p : mds_sessions) { |
| 18080 | if (mdsmap->have_inst(p.first) && mdsmap->get_addrs(p.first) == con->get_peer_addrs()) { |
| 18081 | mds = p.first; |
| 18082 | s = p.second; |
| 18083 | } |
| 18084 | } |
| 18085 | if (mds >= 0) { |
| 18086 | ceph_assert(s != NULL); |
| 18087 | switch (s->state) { |
| 18088 | case MetaSession::STATE_CLOSING: |
| 18089 | ldout(cct, 1) << "reset from mds we were closing; we'll call that closed" << dendl; |
| 18090 | _closed_mds_session(s.get()); |
| 18091 | break; |
| 18092 | |
| 18093 | case MetaSession::STATE_OPENING: |
| 18094 | { |
| 18095 | ldout(cct, 1) << "reset from mds we were opening; retrying" << dendl; |
| 18096 | std::vector<Context*> waiters; |
| 18097 | waiters.swap(s->waiting_for_open); |
| 18098 | _closed_mds_session(s.get()); |
| 18099 | auto news = _get_or_open_mds_session(mds); |
| 18100 | news->waiting_for_open.swap(waiters); |
| 18101 | } |
| 18102 | break; |
| 18103 | |
| 18104 | case MetaSession::STATE_OPEN: |
| 18105 | { |
| 18106 | objecter->maybe_request_map(); /* to check if we are blocklisted */ |
| 18107 | if (cct->_conf.get_val<bool>("client_reconnect_stale")) { |
| 18108 | ldout(cct, 1) << "reset from mds we were open; close mds session for reconnect" << dendl; |
| 18109 | _closed_mds_session(s.get()); |
| 18110 | } else { |
| 18111 | ldout(cct, 1) << "reset from mds we were open; mark session as stale" << dendl; |
| 18112 | s->state = MetaSession::STATE_STALE; |
nothing calls this directly
no test coverage detected