From: Sage Weil Date: Fri, 8 Mar 2013 21:17:23 +0000 (-0800) Subject: client: handle ESTALE redirection in make_request(), not reply handler X-Git-Tag: v0.60~81^2~13 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=6d0b7c83fd1afc1b13cf406c3d618bd5543a1ffb;p=ceph.git client: handle ESTALE redirection in make_request(), not reply handler Resending the request in the reply handler is a bit fugly and throws a small wrench into moving to a MetaSession*-based approach. Check for the case(s) where we *do* return ESTALE explicitly and fall through. Otherwise, kick the caller and let them retry. Signed-off-by: Sage Weil --- diff --git a/src/client/Client.cc b/src/client/Client.cc index a368a093052..660446a9da6 100644 --- a/src/client/Client.cc +++ b/src/client/Client.cc @@ -1675,25 +1675,20 @@ void Client::handle_client_reply(MClientReply *reply) } if (-ESTALE == reply->get_result()) { // see if we can get to proper MDS - request->send_to_auth = true; ldout(cct, 20) << "got ESTALE on tid " << request->tid << " from mds." << request->mds << dendl; + request->send_to_auth = true; request->resend_mds = choose_target_mds(request); if (request->resend_mds >= 0 && - request->resend_mds != request->mds) { // wasn't sent to auth, resend - ldout(cct, 20) << "but it wasn't sent to auth, resending" << dendl; - send_request(request, request->resend_mds); + request->resend_mds == request->mds && + (request->inode == NULL || + request->inode->caps.count(request->resend_mds) == 0 || + request->sent_on_mseq == request->inode->caps[request->resend_mds]->mseq)) { + // have to return ESTALE + } else { + request->caller_cond->Signal(); return; } - if (!request->inode) { - ldout(cct, 10) << "Got ESTALE on request without inode!" << dendl; //do nothing - } else if (request->inode->caps.count(request->resend_mds) && - request->sent_on_mseq != request->inode->caps[request->resend_mds]->mseq) { - // auth data out of date; send it again! - ldout(cct, 20) << "auth data out of date, sending again" << dendl; - send_request(request, request->resend_mds); - return; - } ldout(cct, 20) << "have to return ESTALE" << dendl; }