diff options
author | Yan, Zheng <zheng.z.yan@intel.com> | 2013-01-16 19:58:49 +0800 |
---|---|---|
committer | Yan, Zheng <zheng.z.yan@intel.com> | 2013-01-29 10:17:35 +0800 |
commit | e0aa64d04ddd29fb144b80307d238813d1a43ce3 (patch) | |
tree | 6d9d31de6077523a958d15562d8fac1fe3fc4d25 | |
parent | 85294a5988a4e054c0f209302a9d2096e5294590 (diff) | |
download | ceph-e0aa64d04ddd29fb144b80307d238813d1a43ce3.tar.gz |
mds: don't replace existing slave request
The MDS may receive a client request, but find there is an existing
slave request. It means other MDS is handling the same request, so
we should not replace the slave request with a new client request,
just forward the request.
The client request may include embeded cap releases, we need process
them even the request is forwarded.
Signed-off-by: Yan, Zheng <zheng.z.yan@intel.com>
-rw-r--r-- | src/mds/MDCache.cc | 6 | ||||
-rw-r--r-- | src/mds/Server.cc | 22 |
2 files changed, 16 insertions, 12 deletions
diff --git a/src/mds/MDCache.cc b/src/mds/MDCache.cc index cd24fc2f3a2..b50a58b45ab 100644 --- a/src/mds/MDCache.cc +++ b/src/mds/MDCache.cc @@ -7569,13 +7569,13 @@ MDRequest *MDCache::request_start(MClientRequest *req) if (active_requests.count(req->get_reqid())) { MDRequest *mdr = active_requests[req->get_reqid()]; if (mdr->is_slave()) { - dout(10) << "request_start already had " << *mdr << ", cleaning up" << dendl; - request_cleanup(mdr); + dout(10) << "request_start already had " << *mdr << ", forward new msg" << dendl; + mds->forward_message_mds(req, mdr->slave_to_mds); } else { dout(10) << "request_start already processing " << *mdr << ", dropping new msg" << dendl; req->put(); - return 0; } + return 0; } // register new client request diff --git a/src/mds/Server.cc b/src/mds/Server.cc index 7e6b66a3fef..f72a2869034 100644 --- a/src/mds/Server.cc +++ b/src/mds/Server.cc @@ -1092,28 +1092,32 @@ void Server::handle_client_request(MClientRequest *req) session->trim_completed_requests(req->get_oldest_client_tid()); } + // request_start may drop the request, get a reference for cap release + if (!req->releases.empty() && req->get_source().is_client() && !req->is_replay()) + req->get(); + // register + dispatch MDRequest *mdr = mdcache->request_start(req); - if (!mdr) - return; - if (session) { - mdr->session = session; - session->requests.push_back(&mdr->item_session_request); + if (mdr) { + if (session) { + mdr->session = session; + session->requests.push_back(&mdr->item_session_request); + } } // process embedded cap releases? // (only if NOT replay!) - if (req->get_source().is_client() && - !req->is_replay()) { + if (!req->releases.empty() && req->get_source().is_client() && !req->is_replay()) { client_t client = req->get_source().num(); for (vector<MClientRequest::Release>::iterator p = req->releases.begin(); p != req->releases.end(); p++) mds->locker->process_request_cap_release(mdr, client, p->item, p->dname); + req->put(); } - - dispatch_client_request(mdr); + if (mdr) + dispatch_client_request(mdr); return; } |