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 <sjust@redhat.com>
This commit is contained in:
Samuel Just 2017-02-16 13:22:07 -08:00
parent 48cc5d2643
commit 0c0feca36d
4 changed files with 10 additions and 30 deletions

View File

@ -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) {

View File

@ -2824,7 +2824,7 @@ void PrimaryLogPG::finish_proxy_write(hobject_t oid, ceph_tid_t tid, int r)
const MOSDOp *m = static_cast<const MOSDOp*>(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

View File

@ -205,8 +205,7 @@ public:
ceph_tid_t objecter_tid;
vector<OSDOp> &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<OSDOp>& _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<ProxyWriteOp> ProxyWriteOpRef;

View File

@ -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;