// no need to capture PG ref, repop cancel will handle that
// Can capture the ctx by pointer, it's owned by the repop
- ctx->register_on_applied(
- [m, ctx, this](){
- if (m && m->wants_ack() && !ctx->sent_ack && !ctx->sent_disk) {
- // send ack
- MOSDOpReply *reply = ctx->reply;
- if (reply)
- ctx->reply = NULL;
- else {
- reply = new MOSDOpReply(m, 0, get_osdmap()->get_epoch(), 0, true);
- reply->set_reply_versions(ctx->at_version,
- ctx->user_at_version);
- }
- reply->add_flags(CEPH_OSD_FLAG_ACK);
- dout(10) << " sending ack: " << *m << " " << reply << dendl;
- osd->send_message_osd_client(reply, m->get_connection());
- ctx->sent_ack = true;
- }
- });
ctx->register_on_commit(
[m, ctx, this](){
if (ctx->op)
log_op_stats(
ctx);
- if (m && m->wants_ondisk() && !ctx->sent_disk) {
- // send commit.
+ if (m && (m->wants_ondisk() || m->wants_ack()) && !ctx->sent_reply) {
MOSDOpReply *reply = ctx->reply;
if (reply)
ctx->reply = NULL;
ctx->user_at_version);
}
reply->add_flags(CEPH_OSD_FLAG_ACK | CEPH_OSD_FLAG_ONDISK);
- dout(10) << " sending commit on " << *m << " " << reply << dendl;
+ dout(10) << " sending reply on " << *m << " " << reply << dendl;
osd->send_message_osd_client(reply, m->get_connection());
- ctx->sent_disk = true;
+ ctx->sent_reply = true;
ctx->op->mark_commit_sent();
}
});
on_committed.emplace_back(std::forward<F>(f));
}
- bool sent_ack;
- bool sent_disk;
+ bool sent_reply;
// pending async reads <off, len, op_flags> -> <outbl, outr>
list<pair<boost::tuple<uint64_t, uint64_t, unsigned>,
num_read(0),
num_write(0),
copy_cb(NULL),
- sent_ack(false), sent_disk(false),
+ sent_reply(false),
async_read_result(0),
inflightreads(0),
lock_type(ObjectContext::RWState::RWNONE) {