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

Method dispatch_client_request

src/mds/Server.cc:2754–2951  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2752}
2753
2754void Server::dispatch_client_request(const MDRequestRef& mdr)
2755{
2756 // we shouldn't be waiting on anyone.
2757 ceph_assert(!mdr->has_more() || mdr->more()->waiting_on_peer.empty());
2758
2759 if (mdr->killed) {
2760 // Should already be reset in request_cleanup().
2761 ceph_assert(!mdr->is_batch_head());
2762 return;
2763 } else if (mdr->aborted) {
2764 mdr->aborted = false;
2765 mdcache->request_kill(mdr);
2766 return;
2767 }
2768
2769 const cref_t<MClientRequest> &req = mdr->client_request;
2770
2771 if (logger) logger->inc(l_mdss_dispatch_client_request);
2772
2773 dout(7) << "dispatch_client_request " << *req << dendl;
2774
2775 auto zeroms = std::chrono::milliseconds::zero();
2776 if (unlikely(dispatch_client_request_delay > zeroms)) {
2777 std::this_thread::sleep_for(dispatch_client_request_delay);
2778 }
2779 if (unlikely(dispatch_killpoint_random > 0.0) && dispatch_killpoint_random >= ceph::util::generate_random_number(0.0, 1.0)) {
2780 ceph_abort("dispatch_killpoint_random");
2781 }
2782
2783 if (req->may_write() && mdcache->is_readonly()) {
2784 dout(10) << " read-only FS" << dendl;
2785 respond_to_request(mdr, -EROFS);
2786 return;
2787 }
2788 if (mdr->has_more() && mdr->more()->peer_error) {
2789 dout(10) << " got error from peers" << dendl;
2790 respond_to_request(mdr, mdr->more()->peer_error);
2791 return;
2792 }
2793
2794 if (is_full) {
2795 if (req->get_op() == CEPH_MDS_OP_SETLAYOUT ||
2796 req->get_op() == CEPH_MDS_OP_SETDIRLAYOUT ||
2797 req->get_op() == CEPH_MDS_OP_RMXATTR ||
2798 req->get_op() == CEPH_MDS_OP_SETXATTR ||
2799 req->get_op() == CEPH_MDS_OP_CREATE ||
2800 req->get_op() == CEPH_MDS_OP_SYMLINK ||
2801 req->get_op() == CEPH_MDS_OP_MKSNAP ||
2802 ((req->get_op() == CEPH_MDS_OP_LINK ||
2803 req->get_op() == CEPH_MDS_OP_RENAME) &&
2804 (!mdr->has_more() || mdr->more()->witnessed.empty())) // haven't started peer request
2805 ) {
2806 /*
2807 * The inode fetch below is specific to the operations above and the inode is
2808 * expected to be in memory as these operations are likely preceded by lookup.
2809 * Doing this generically outside the condition was incorrect as the ops like
2810 * getattr might not have the inode in memory as this could be a non-auth mds
2811 * and fails with ESTALE confusing the client without forwarding to the auth mds.

Callers 2

finishMethod · 0.80
dispatch_requestMethod · 0.80

Calls 15

generate_random_numberFunction · 0.85
ceph_mds_op_nameFunction · 0.85
is_batch_headMethod · 0.80
request_killMethod · 0.80
get_filepathMethod · 0.80
inodeno_tClass · 0.50
has_moreMethod · 0.45
emptyMethod · 0.45
moreMethod · 0.45
incMethod · 0.45
may_writeMethod · 0.45
is_readonlyMethod · 0.45

Tested by

no test coverage detected