MCPcopy Create free account
hub / github.com/ceph/ceph / handle_client_request_forward

Method handle_client_request_forward

src/client/Client.cc:2924–2978  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2922
2923
2924void Client::handle_client_request_forward(const MConstRef<MClientRequestForward>& fwd)
2925{
2926 mds_rank_t mds = mds_rank_t(fwd->get_source().num());
2927
2928 std::scoped_lock cl(client_lock);
2929 auto session = _get_mds_session(mds, fwd->get_connection().get());
2930 if (!session) {
2931 return;
2932 }
2933 ceph_tid_t tid = fwd->get_tid();
2934
2935 auto it = mds_requests.find(tid);
2936 if ( it == mds_requests.end()) {
2937 ldout(cct, 10) << __func__ << " no pending request on tid " << tid << dendl;
2938 return;
2939 }
2940
2941 MetaRequest *request = it->second;
2942 ceph_assert(request);
2943
2944 /*
2945 * Avoid inifinite retrying after overflow.
2946 *
2947 * The MDS will increase the fwd count and in client side
2948 * if the num_fwd is less than the one saved in request
2949 * that means the MDS is an old version and overflowed of
2950 * 8 bits.
2951 */
2952 auto num_fwd = fwd->get_num_fwd();
2953 if (num_fwd <= request->num_fwd || (uint32_t)num_fwd >= UINT32_MAX) {
2954 request->abort(-EMULTIHOP);
2955 request->caller_cond->notify_all();
2956 ldout(cct, 0) << __func__ << " request tid " << tid << " new num_fwd "
2957 << num_fwd << " old num_fwd " << request->num_fwd << ", fwd seq overflow"
2958 << ", abort it" << dendl;
2959 return;
2960 }
2961
2962 // reset retry counter
2963 request->retry_attempt = 0;
2964
2965 // request not forwarded, or dest mds has no session.
2966 // resend.
2967 ldout(cct, 10) << __func__ << " tid " << tid
2968 << " fwd " << fwd->get_num_fwd()
2969 << " to mds." << fwd->get_dest_mds()
2970 << ", resending to " << fwd->get_dest_mds()
2971 << dendl;
2972
2973 request->mds = -1;
2974 request->item.remove_myself();
2975 request->num_fwd = num_fwd;
2976 request->resend_mds = fwd->get_dest_mds();
2977 request->caller_cond->notify_all();
2978}
2979
2980bool Client::is_dir_operation(MetaRequest *req)
2981{

Callers

nothing calls this directly

Calls 12

get_dest_mdsMethod · 0.80
numMethod · 0.45
get_sourceMethod · 0.45
getMethod · 0.45
get_connectionMethod · 0.45
get_tidMethod · 0.45
findMethod · 0.45
endMethod · 0.45
get_num_fwdMethod · 0.45
abortMethod · 0.45
notify_allMethod · 0.45
remove_myselfMethod · 0.45

Tested by

no test coverage detected