Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions src/mds/Server.cc
Original file line number Diff line number Diff line change
Expand Up @@ -577,7 +577,7 @@ void Server::handle_client_session(const cref_t<MClientSession> &m)
session->is_open() ||
session->is_stale() ||
session->is_killing() ||
terminating_sessions) {
terminating_sessions && !session->is_forced_open()) {
dout(10) << "currently open|opening|stale|killing, dropping this req" << dendl;
return;
}
Expand Down Expand Up @@ -1002,6 +1002,7 @@ void Server::finish_force_open_sessions(const map<client_t,pair<Session*,uint64_
mds->sessionmap.set_state(session, Session::STATE_OPEN);
mds->sessionmap.touch_session(session);
metrics_handler->add_session(session);
session->set_forced_open(true);

auto reply = make_message<MClientSession>(CEPH_SESSION_OPEN);
if (session->info.has_feature(CEPHFS_FEATURE_MIMIC))
Expand Down Expand Up @@ -1545,6 +1546,7 @@ void Server::handle_client_reconnect(const cref_t<MClientReconnect> &m)
// remove from gather set
client_reconnect_gather.erase(from);
session->set_reconnecting(false);
session->set_client_not_open(false);
if (client_reconnect_gather.empty())
reconnect_gather_finish();
}
Expand Down Expand Up @@ -1701,7 +1703,7 @@ void Server::reconnect_tick()
// make _session_logged() purge orphan objects of lost async/unsafe requests
session->delegated_inos.swap(session->free_prealloc_inos);

if (g_conf()->mds_session_blocklist_on_timeout) {
if (g_conf()->mds_session_blocklist_on_timeout && !session->is_client_not_open()) {
CachedStackStringStream css;
mds->evict_client(session->get_client().v, false, true, *css,
gather.new_sub());
Expand Down
6 changes: 5 additions & 1 deletion src/mds/SessionMap.cc
Original file line number Diff line number Diff line change
Expand Up @@ -748,7 +748,8 @@ void SessionMap::replay_advance_version()

void SessionMap::replay_open_sessions(version_t event_cmapv,
map<client_t,entity_inst_t>& client_map,
map<client_t,client_metadata_t>& client_metadata_map)
map<client_t,client_metadata_t>& client_metadata_map,
bool client_not_open)
Comment thread
sidharthanup marked this conversation as resolved.
Resolved
{
unsigned already_saved;

Expand All @@ -773,6 +774,9 @@ void SessionMap::replay_open_sessions(version_t event_cmapv,
continue;
}

if (client_not_open) {
s->set_client_not_open(true);
}
set_state(s, Session::STATE_OPEN);
replay_dirty_session(s);
}
Expand Down
14 changes: 13 additions & 1 deletion src/mds/SessionMap.h
Original file line number Diff line number Diff line change
Expand Up @@ -242,6 +242,14 @@ class Session : public RefCountedObject {
}
bool is_importing() const { return importing_count > 0; }

void set_client_not_open(bool s) { client_not_open = s; }

bool is_client_not_open() { return client_not_open; }

void set_forced_open(bool s) { forced_open = s; }

bool is_forced_open() { return forced_open; }

void set_load_avg_decay_rate(double rate) {
ceph_assert(is_open() || is_stale());
load_avg = DecayCounter(rate);
Expand Down Expand Up @@ -449,6 +457,9 @@ class Session : public RefCountedObject {
uint64_t state_seq = 0;
int importing_count = 0;

bool client_not_open = false;
bool forced_open = false;

std::string human_name;

// Versions in this session was projected: used to verify
Expand Down Expand Up @@ -782,7 +793,8 @@ class SessionMap : public SessionMapStore {
*/
void replay_open_sessions(version_t event_cmapv,
std::map<client_t,entity_inst_t>& client_map,
std::map<client_t,client_metadata_t>& client_metadata_map);
std::map<client_t,client_metadata_t>& client_metadata_map,
bool client_not_open = false);

/**
* For these session IDs, if a session exists with this ID, and it has
Expand Down
3 changes: 2 additions & 1 deletion src/mds/journal.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1788,6 +1788,7 @@ void ESession::replay(MDSRank *mds)
session = mds->sessionmap.get_or_add_session(client_inst);
mds->sessionmap.set_state(session, Session::STATE_OPEN);
session->set_client_metadata(client_metadata);
session->set_client_not_open(false);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

no code submits the ESession event

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here It's just clearing the client_not_open flag set during EImportStart replay. Meaning the client had actually opened the connection and so we don't need this flag to be set. So during reconnect if the flag is set and the client failed to reconnect, then we kill the session and if it is not set and client failed to reconnect, then blacklist.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

check Server::handle_client_session(). if session is already being opened by Server::prepare_force_open_sessions. it does not submit ESession event

dout(10) << " opened session " << session->info.inst << dendl;
} else {
session = mds->sessionmap.get_session(client_inst.name);
Expand Down Expand Up @@ -3079,7 +3080,7 @@ void EImportStart::replay(MDSRank *mds)
decode(cm, blp);
if (!blp.end())
decode(cmm, blp);
mds->sessionmap.replay_open_sessions(cmapv, cm, cmm);
mds->sessionmap.replay_open_sessions(cmapv, cm, cmm, true);
}
update_segment();
}
Expand Down