]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
client: Fix assert when stale arrives before open
authorSam Lang <sam.lang@inktank.com>
Fri, 5 Oct 2012 16:10:05 +0000 (11:10 -0500)
committerSam Lang <sam.lang@inktank.com>
Fri, 5 Oct 2012 21:12:32 +0000 (16:12 -0500)
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 <sam.lang@inktank.com>
src/client/Client.cc

index 43abe4b7c3b844cf25b5ccc761eb9d06826f0d4d..2c3ba3f2bb36db0c16d893244ae85722da899f07 100644 (file)
@@ -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: