]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
uclient: and reply cond guard; make forward _always_ resend request
authorSage Weil <sage@newdream.net>
Thu, 10 Sep 2009 21:00:53 +0000 (14:00 -0700)
committerSage Weil <sage@newdream.net>
Thu, 10 Sep 2009 21:00:53 +0000 (14:00 -0700)
src/client/Client.cc
src/client/Client.h

index 3456c9cebfb6e4377f2259f28af4feb3e2596de1..eb2ba2fceda72ac7042c4f2276e28b9f2988a395 100644 (file)
@@ -852,8 +852,12 @@ int Client::make_request(MClientRequest *req,
     send_request(request, mds);
 
     // wait for signal
-    dout(20) << "awaiting kick on " << &cond << dendl;
-    cond.Wait(client_lock);
+    dout(20) << "awaiting reply|forward|kick on " << &cond << dendl;
+    request->kick = false;
+    while (!request->reply &&         // reply
+          request->resend_mds < 0 && // forward
+          !request->kick)
+      cond.Wait(client_lock);
     
     // did we get a reply?
     if (request->reply) 
@@ -984,43 +988,18 @@ void Client::handle_client_request_forward(MClientRequestForward *fwd)
   // reset retry counter
   request->retry_attempt = 0;
 
-  if (!fwd->must_resend() && 
-      mds_sessions.count(fwd->get_dest_mds())) {
-    // dest mds has a session, and request was forwarded for us.
-
-    // note new mds set.
-    if (request->num_fwd < fwd->get_num_fwd()) {
-      // there are now exactly two mds's whose failure should trigger a resend
-      // of this request.
-      request->mds.clear();
-      request->mds.insert(fwd->get_source().num());
-      request->mds.insert(fwd->get_dest_mds());
-      request->num_fwd = fwd->get_num_fwd();
-      dout(10) << "handle_client_request tid " << tid
-              << " fwd " << fwd->get_num_fwd() 
-              << " to mds" << fwd->get_dest_mds() 
-              << ", mds set now " << request->mds
-              << dendl;
-    } else {
-      dout(10) << "handle_client_request tid " << tid
-              << " previously forwarded to mds" << fwd->get_dest_mds() 
-              << ", mds still " << request->mds
-                << dendl;
-    }
-  } else {
-    // request not forwarded, or dest mds has no session.
-    // resend.
-    dout(10) << "handle_client_request tid " << tid
-            << " fwd " << fwd->get_num_fwd() 
-            << " to mds" << fwd->get_dest_mds() 
-            << ", non-idempotent, resending to " << fwd->get_dest_mds()
-            << dendl;
-
-    request->mds.clear();
-    request->num_fwd = fwd->get_num_fwd();
-    request->resend_mds = fwd->get_dest_mds();
-    request->caller_cond->Signal();
-  }
+  // request not forwarded, or dest mds has no session.
+  // resend.
+  dout(10) << "handle_client_request tid " << tid
+          << " fwd " << fwd->get_num_fwd() 
+          << " to mds" << fwd->get_dest_mds() 
+          << ", resending to " << fwd->get_dest_mds()
+          << dendl;
+  
+  request->mds.clear();
+  request->num_fwd = fwd->get_num_fwd();
+  request->resend_mds = fwd->get_dest_mds();
+  request->caller_cond->Signal();
 
   delete fwd;
 }
@@ -1280,6 +1259,7 @@ void Client::kick_requests(int mds, bool signal)
        ++p) 
     if (p->second->mds.count(mds)) {
       if (signal) {
+       p->second->kick = true;
        p->second->caller_cond->Signal();
       }
       else {
index ba85962280649243a9a60b95342f3f01f6f1d304..8b548dd50c02c7774a905ecc0850826cd041d54a 100644 (file)
@@ -107,6 +107,7 @@ struct MetaRequest {
   int      ref;
   
   MClientReply *reply;         // the reply
+  bool kick;
   
   //possible responses
   bool got_safe;
@@ -124,7 +125,7 @@ struct MetaRequest {
     tid(t), request(req), 
     resend_mds(-1), num_fwd(0), retry_attempt(0),
     ref(1), reply(0), 
-    got_safe(false), got_unsafe(false), unsafe_item(this),
+    kick(false), got_safe(false), got_unsafe(false), unsafe_item(this),
     lock("MetaRequest lock"),
     caller_cond(0), dispatch_cond(0), target(0) { }