@@ -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
@@ -1096,28 +1096,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;
}