From: Greg Farnum Date: Wed, 1 Jul 2009 19:02:42 +0000 (-0700) Subject: BROKEN, DON'T USE. X-Git-Tag: v0.10~95^2~1 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=bb23de4cee7cd9c6a4cdfafc1247a4042d40fb84;p=ceph.git BROKEN, DON'T USE. uclient changes that somehow broke message delivery without changing anything in that process --- diff --git a/src/client/Client.cc b/src/client/Client.cc index 2bc2c4944407..58faf7816990 100644 --- a/src/client/Client.cc +++ b/src/client/Client.cc @@ -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 + } } diff --git a/src/client/Client.h b/src/client/Client.h index 9bdec886659b..1e4387b5d63d 100644 --- a/src/client/Client.h +++ b/src/client/Client.h @@ -112,6 +112,7 @@ struct MetaRequest { private: xlist::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::item * get_meta_item() {