Skip to content

Commit

Permalink
client: fix fuse client hang because its pipe to mds is not ok
Browse files Browse the repository at this point in the history
If fuse client session had been killed by mds and the mds daemon restart
or hot-standby switch happens right away but the client did not receive
any message from monitor due to network or other whatever reason untill
the mds become active again.Thus cause client didn't do closed_mds_session
lead the seession still is STATE_OPEN but client can't send any message to
mds because its pipe is not ok.

So we should create pipe to mds guarantee any meta request can be sent to
server.When mds recevie the message will send a CLOSE_SESSION to client
becasue its session for this client is STATE_CLOSED.After the previous
steps the old session of client can be closed and new session and pipe
can be established and the mountpoint will be ok.

Fixes:http://tracker.ceph.com/issues/36079

Signed-off-by:Guan yunfei <yunfei.guan@xtaotech.com>
  • Loading branch information
YunfeiGuan committed Sep 19, 2018
1 parent 7591ccd commit c913e11
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 1 deletion.
4 changes: 4 additions & 0 deletions src/client/Client.cc
Expand Up @@ -2668,6 +2668,10 @@ void Client::handle_mds_map(MMDSMap* m)
} else if (mdsmap->get_addrs(mds) != session->addrs) {
session->con->mark_down();
session->addrs = mdsmap->get_addrs(mds);
if (mds_sessions.count(p->first)) {
ldout(cct, 1) << "handle_mds_map update connection " << dendl;
session->con = messenger->connect_to_mds(session->addrs);
}
// When new MDS starts to take over, notify kernel to trim unused entries
// in its dcache/icache. Hopefully, the kernel will release some unused
// inodes before the new MDS enters reconnect state.
Expand Down
5 changes: 5 additions & 0 deletions src/mds/Server.cc
Expand Up @@ -1777,6 +1777,11 @@ void Server::handle_client_request(const MClientRequest::const_ref &req)
session->is_closing() ||
session->is_killing()) {
dout(5) << "session closed|closing|killing, dropping" << dendl;
if (session->is_closed()) {
dout(1) << "send SESSION_CLOSE to client,so that it can reopen session" << dendl;
mds->send_message_client(new MClientSession(CEPH_SESSION_CLOSE), session);
return;
}
session = NULL;
}
if (!session) {
Expand Down
2 changes: 1 addition & 1 deletion src/msg/simple/SimpleMessenger.cc
Expand Up @@ -708,7 +708,7 @@ void SimpleMessenger::mark_down(Connection *con)
lock.Lock();
Pipe *p = static_cast<Pipe *>(static_cast<PipeConnection*>(con)->get_pipe());
if (p) {
ldout(cct,1) << "mark_down " << con << " -- " << p << dendl;
ldout(cct,0) << "mark_down " << con << " -- " << p << dendl;
ceph_assert(p->msgr == this);
p->unregister_pipe();
p->pipe_lock.Lock();
Expand Down

0 comments on commit c913e11

Please sign in to comment.