From 0c0feca36d487e3a7d686d390fb7ccb431b6e119 Mon Sep 17 00:00:00 2001 From: Samuel Just Date: Thu, 16 Feb 2017 13:22:07 -0800 Subject: [PATCH] osd,osdc: eliminate FLAG_ONDISK and helpers The objecter actually always needs to get a response in order to be able to not continually resend ops (even if the caller didn't provide a callback). Thus, it makes no sense for an MOSDOp to ever not have FLAG_ONDISK set. Therefore, we'll just remove the helper and assume it's always there (it's safe to send a response the client didn't ask for, the error paths already do that). On the Objecter side, we'll just unconditionally fill in ONDISK for the benefit of pre-luminous OSDs. Fixes: http://tracker.ceph.com/issues/18961 Signed-off-by: Samuel Just --- src/messages/MOSDOp.h | 7 ------- src/osd/PrimaryLogPG.cc | 20 +++----------------- src/osd/PrimaryLogPG.h | 7 +++---- src/osdc/Objecter.cc | 6 ++++-- 4 files changed, 10 insertions(+), 30 deletions(-) diff --git a/src/messages/MOSDOp.h b/src/messages/MOSDOp.h index 8946652a913..b6797ac9d1b 100755 --- a/src/messages/MOSDOp.h +++ b/src/messages/MOSDOp.h @@ -232,13 +232,6 @@ public: } bool has_flag(__u32 flag) const { return flags & flag; }; - bool wants_ack() const { return flags & CEPH_OSD_FLAG_ACK; } - bool wants_ondisk() const { return flags & CEPH_OSD_FLAG_ONDISK; } - bool wants_onnvram() const { return flags & CEPH_OSD_FLAG_ONNVRAM; } - - void set_want_ack(bool b) { flags |= CEPH_OSD_FLAG_ACK; } - void set_want_onnvram(bool b) { flags |= CEPH_OSD_FLAG_ONNVRAM; } - void set_want_ondisk(bool b) { flags |= CEPH_OSD_FLAG_ONDISK; } bool is_retry_attempt() const { return flags & CEPH_OSD_FLAG_RETRY; } void set_retry_attempt(unsigned a) { diff --git a/src/osd/PrimaryLogPG.cc b/src/osd/PrimaryLogPG.cc index 68e61f903ad..49a18946438 100644 --- a/src/osd/PrimaryLogPG.cc +++ b/src/osd/PrimaryLogPG.cc @@ -2824,7 +2824,7 @@ void PrimaryLogPG::finish_proxy_write(hobject_t oid, ceph_tid_t tid, int r) const MOSDOp *m = static_cast(pwop->op->get_req()); assert(m != NULL); - if (m->wants_ondisk() && !pwop->sent_disk) { + if (!pwop->sent_reply) { // send commit. MOSDOpReply *reply = pwop->ctx->reply; if (reply) @@ -2836,21 +2836,8 @@ void PrimaryLogPG::finish_proxy_write(hobject_t oid, ceph_tid_t tid, int r) reply->add_flags(CEPH_OSD_FLAG_ACK | CEPH_OSD_FLAG_ONDISK); dout(10) << " sending commit on " << pwop << " " << reply << dendl; osd->send_message_osd_client(reply, m->get_connection()); - pwop->sent_disk = true; + pwop->sent_reply = true; pwop->ctx->op->mark_commit_sent(); - } else if (m->wants_ack() && !pwop->sent_ack && !pwop->sent_disk) { - // send ack - MOSDOpReply *reply = pwop->ctx->reply; - if (reply) - pwop->ctx->reply = NULL; - else { - reply = new MOSDOpReply(m, r, get_osdmap()->get_epoch(), 0, true); - reply->set_reply_versions(eversion_t(), pwop->user_version); - } - reply->add_flags(CEPH_OSD_FLAG_ACK); - dout(10) << " sending ack on " << pwop << " " << reply << dendl; - osd->send_message_osd_client(reply, m->get_connection()); - pwop->sent_ack = true; } delete pwop->ctx; @@ -3133,7 +3120,7 @@ void PrimaryLogPG::execute_ctx(OpContext *ctx) log_op_stats( ctx); - if (m && (m->wants_ondisk() || m->wants_ack()) && !ctx->sent_reply) { + if (m && !ctx->sent_reply) { MOSDOpReply *reply = ctx->reply; if (reply) ctx->reply = NULL; @@ -8311,7 +8298,6 @@ void PrimaryLogPG::eval_repop(RepGather *repop) if (m) dout(10) << "eval_repop " << *repop - << " wants=" << (m->wants_ack() ? "a":"") << (m->wants_ondisk() ? "d":"") << (repop->rep_done ? " DONE" : "") << dendl; else diff --git a/src/osd/PrimaryLogPG.h b/src/osd/PrimaryLogPG.h index f48c1610c8e..f79a41c85fb 100644 --- a/src/osd/PrimaryLogPG.h +++ b/src/osd/PrimaryLogPG.h @@ -205,8 +205,7 @@ public: ceph_tid_t objecter_tid; vector &ops; version_t user_version; - bool sent_disk; - bool sent_ack; + bool sent_reply; utime_t mtime; bool canceled; osd_reqid_t reqid; @@ -214,8 +213,8 @@ public: ProxyWriteOp(OpRequestRef _op, hobject_t oid, vector& _ops, osd_reqid_t _reqid) : ctx(NULL), op(_op), soid(oid), objecter_tid(0), ops(_ops), - user_version(0), sent_disk(false), - sent_ack(false), canceled(false), + user_version(0), sent_reply(false), + canceled(false), reqid(_reqid) { } }; typedef ceph::shared_ptr ProxyWriteOpRef; diff --git a/src/osdc/Objecter.cc b/src/osdc/Objecter.cc index 69a141329a3..3cca39e5acc 100644 --- a/src/osdc/Objecter.cc +++ b/src/osdc/Objecter.cc @@ -3058,8 +3058,10 @@ MOSDOp *Objecter::_prepare_osd_op(Op *op) int flags = op->target.flags; flags |= CEPH_OSD_FLAG_KNOWN_REDIR; - if (op->onfinish) - flags |= CEPH_OSD_FLAG_ONDISK; + + // Nothing checks this any longer, but needed for compatibility with + // pre-luminous osds + flags |= CEPH_OSD_FLAG_ONDISK; if (!honor_osdmap_full) flags |= CEPH_OSD_FLAG_FULL_FORCE; -- 2.39.5