| 2287 | } |
| 2288 | |
| 2289 | void Server::early_reply(const MDRequestRef& mdr, CInode *tracei, CDentry *tracedn) |
| 2290 | { |
| 2291 | if (!g_conf()->mds_early_reply) |
| 2292 | return; |
| 2293 | |
| 2294 | if (mdr->no_early_reply) { |
| 2295 | dout(10) << "early_reply - flag no_early_reply is set, not allowed." << dendl; |
| 2296 | return; |
| 2297 | } |
| 2298 | |
| 2299 | if (mdr->has_more() && mdr->more()->has_journaled_peers) { |
| 2300 | dout(10) << "early_reply - there are journaled peers, not allowed." << dendl; |
| 2301 | return; |
| 2302 | } |
| 2303 | |
| 2304 | if (mdr->alloc_ino) { |
| 2305 | dout(10) << "early_reply - allocated ino, not allowed" << dendl; |
| 2306 | return; |
| 2307 | } |
| 2308 | |
| 2309 | const cref_t<MClientRequest> &req = mdr->client_request; |
| 2310 | entity_inst_t client_inst = req->get_source_inst(); |
| 2311 | if (client_inst.name.is_mds()) |
| 2312 | return; |
| 2313 | |
| 2314 | if (req->is_replay()) { |
| 2315 | dout(10) << " no early reply on replay op" << dendl; |
| 2316 | return; |
| 2317 | } |
| 2318 | |
| 2319 | |
| 2320 | auto reply = ceph::make_message<MClientReply>(*req, 0); |
| 2321 | reply->set_unsafe(); |
| 2322 | |
| 2323 | // mark xlocks "done", indicating that we are exposing uncommitted changes. |
| 2324 | // |
| 2325 | //_rename_finish() does not send dentry link/unlink message to replicas. |
| 2326 | // so do not set xlocks on dentries "done", the xlocks prevent dentries |
| 2327 | // that have projected linkages from getting new replica. |
| 2328 | mds->locker->set_xlocks_done(mdr.get(), req->get_op() == CEPH_MDS_OP_RENAME); |
| 2329 | |
| 2330 | dout(10) << "early_reply " << reply->get_result() |
| 2331 | << " (" << cpp_strerror(reply->get_result()) |
| 2332 | << ") " << *req << dendl; |
| 2333 | |
| 2334 | if (tracei || tracedn) { |
| 2335 | if (tracei) |
| 2336 | mdr->cap_releases.erase(tracei->vino()); |
| 2337 | if (tracedn) |
| 2338 | mdr->cap_releases.erase(tracedn->get_dir()->get_inode()->vino()); |
| 2339 | |
| 2340 | set_trace_dist(reply, tracei, tracedn, mdr); |
| 2341 | } |
| 2342 | |
| 2343 | reply->set_extra_bl(mdr->reply_extra_bl); |
| 2344 | mds->send_message_client(reply, mdr->session); |
| 2345 | |
| 2346 | mdr->did_early_reply = true; |
nothing calls this directly
no test coverage detected