]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
BROKEN, DON'T USE.
authorGreg Farnum <gregf@hq.newdream.net>
Wed, 1 Jul 2009 19:02:42 +0000 (12:02 -0700)
committerGreg Farnum <gregf@hq.newdream.net>
Wed, 1 Jul 2009 19:02:42 +0000 (12:02 -0700)
uclient changes that somehow broke message delivery without changing anything in that process

src/client/Client.cc
src/client/Client.h

index 2bc2c4944407c9c71ba58941f0b955da037f5e30..58faf7816990737689baba7042c10d70e50c39ee 100644 (file)
@@ -842,7 +842,6 @@ MClientReply *Client::make_request(MClientRequest *req,
     // did we get a reply?
     if (request->reply) 
       break;
-
   }
 
   // got it!
@@ -854,11 +853,6 @@ MClientReply *Client::make_request(MClientRequest *req,
   request->dispatch_cond->Signal();
   dout(20) << "sendrecv kickback on tid " << tid << " " << request->dispatch_cond << dendl;
   
-  // clean up.
-  mds_requests.erase(tid);
-  request->put(); //for the dumb data structure
-
-
   // insert trace
   utime_t from = request->sent_stamp;
   Inode *target = insert_trace(request->get(), from, mds);
@@ -1020,11 +1014,11 @@ void Client::handle_client_reply(MClientReply *reply)
   dout(20) << "handle_client_reply got a reply. Safe:" << reply->is_safe()
           << " tid:" << tid << dendl;
   int mds_num = reply->get_source().num();
+  assert(mds_sessions.count(mds_num));
   MetaRequest *request = mds_requests[tid]->get();
   assert(request);
   
   // store reply
-  //  if (!request->reply && !reply->is_safe()) //safe replies have no useful info
   request->reply = reply;
   
   if ((request->got_unsafe && !reply->is_safe())
@@ -1032,7 +1026,7 @@ void Client::handle_client_reply(MClientReply *reply)
     //duplicate response
     dout(0) << "got a duplicate reply on " << tid << " from mds "
            << mds_num << " safe:" << reply->is_safe() << dendl;
-    request->put();
+    goto cleanup;
     return;
   }
   
@@ -1069,6 +1063,10 @@ void Client::handle_client_reply(MClientReply *reply)
 
  cleanup:
   request->put();
+  if(request->got_safe) {
+    mds_requests.erase(tid);
+    request->put(); //for the dumb data structure
+  }
 }
 
 
index 9bdec886659b465a02069014774fab6fb05ec9ba..1e4387b5d63d53cfbf55e37355c54fc4dbdd200a 100644 (file)
@@ -112,6 +112,7 @@ struct MetaRequest {
 
 private:
   xlist<MetaRequest*>::item unsafe_item;
+  Mutex lock; //for get/set sync
 public:
   Cond  *caller_cond;          // who to take up
   Cond  *dispatch_cond;        // who to kick back
@@ -121,23 +122,27 @@ public:
     resend_mds(-1), num_fwd(0), retry_attempt(0),
     ref(1), reply(0), 
     got_safe(false), got_unsafe(false), unsafe_item(this),
+    lock("MetaRequest lock"),
     caller_cond(0), dispatch_cond(0) { }
 
   MetaRequest* get() {
+    lock.Lock();
     ++ref;
-    cerr << "Get called on MetaRequest tid " << tid
-        << "Refcount is " << ref
-        << " Type is " << request->head.op << std::endl;
+    cout << "Get called on MetaRequest tid " << tid
+        << "Refcount is " << ref << std::endl;
+    lock.Unlock();
     return this; }
 
   void put() {
-    cerr << "Put called on MetaRequest tid " << tid;
-    if (--ref == 0) {
-      cerr << "MetaRequest tid" << tid << " deleting." << std::endl;
+    lock.Lock();
+    cout << "Put called on MetaRequest tid " << tid;
+    --ref;
+    lock.Unlock();
+    if (ref == 0) {
+      cout << "MetaRequest tid" << tid << " deleting." << std::endl;
       delete this;
     }
-    cerr << "Refcount is " << ref
-        << " Type is " << request->head.op << std::endl;
+    cout << "Refcount is " << ref << std::endl;
   }
 
   xlist<MetaRequest*>::item * get_meta_item() {