From 082746d6d071ad147c48dcbaafcdf2fc342031b7 Mon Sep 17 00:00:00 2001 From: Sam Lang Date: Fri, 5 Oct 2012 11:10:05 -0500 Subject: [PATCH] client: Fix assert when stale arrives before open The client sends an open session request to the mds, which may not get a chance to reply before the mds timer times out the session and sends the client a stale message. This fix avoids the assertion by checking that a pending open session request is in progress. Signed-off-by: Sam Lang --- src/client/Client.cc | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/src/client/Client.cc b/src/client/Client.cc index 43abe4b7c3b84..2c3ba3f2bb36d 100644 --- a/src/client/Client.cc +++ b/src/client/Client.cc @@ -1289,9 +1289,22 @@ void Client::handle_client_session(MClientSession *m) break; case CEPH_SESSION_STALE: - assert(mds_session); - mds_session->was_stale = true; - renew_caps(from); + /* check that if we don't have a valid mds_session for this mds, + * we're still waiting for the open session reply */ + if (mds_session) { + renew_caps(from); + } else { + if (waiting_for_session.count(from) != 0) { + ldout(cct, 10) << "handle_client_session " << *m + << " still waiting for open session reply" << dendl; + // don't signal waiters, just return + m->put(); + return; + } else { + // how can we get a stale mds without an open or pending session? + assert(mds_session); + } + } break; case CEPH_SESSION_RECALL_STATE: -- 2.39.5