{
dout(10) << __func__ << dendl;
for (auto& op : in_progress_ops) {
- delete op.second.on_commit;
+ delete op.second->on_commit;
+ op.second->on_commit = nullptr;
}
in_progress_ops.clear();
clear_recovery_state();
class C_OSD_OnOpCommit : public Context {
ReplicatedBackend *pg;
- ReplicatedBackend::InProgressOp *op;
+ ReplicatedBackend::InProgressOpRef op;
public:
C_OSD_OnOpCommit(ReplicatedBackend *pg, ReplicatedBackend::InProgressOp *op)
: pg(pg), op(op) {}
auto insert_res = in_progress_ops.insert(
make_pair(
tid,
- InProgressOp(
+ new InProgressOp(
tid, on_all_commit,
orig_op, at_version)
)
);
assert(insert_res.second);
- InProgressOp &op = insert_res.first->second;
+ InProgressOp &op = *insert_res.first->second;
op.waiting_for_commit.insert(
parent->get_acting_recovery_backfill_shards().begin(),
}
void ReplicatedBackend::op_commit(
- InProgressOp *op)
+ InProgressOpRef& op)
{
+ if (op->on_commit == nullptr) {
+ // aborted
+ return;
+ }
+
FUNCTRACE(cct);
OID_EVENT_TRACE_WITH_MSG((op && op->op) ? op->op->get_req() : NULL, "OP_COMMIT_BEGIN", true);
dout(10) << __func__ << ": " << op->tid << dendl;
auto iter = in_progress_ops.find(rep_tid);
if (iter != in_progress_ops.end()) {
- InProgressOp &ip_op = iter->second;
+ InProgressOp &ip_op = *iter->second;
const MOSDOp *m = NULL;
if (ip_op.op)
m = static_cast<const MOSDOp *>(ip_op.op->get_req());
/**
* Client IO
*/
- struct InProgressOp {
+ struct InProgressOp : public RefCountedObject {
ceph_tid_t tid;
set<pg_shard_t> waiting_for_commit;
Context *on_commit;
InProgressOp(
ceph_tid_t tid, Context *on_commit,
OpRequestRef op, eversion_t v)
- : tid(tid), on_commit(on_commit),
+ : RefCountedObject(nullptr, 0),
+ tid(tid), on_commit(on_commit),
op(op), v(v) {}
bool done() const {
return waiting_for_commit.empty();
}
};
- map<ceph_tid_t, InProgressOp> in_progress_ops;
+ typedef boost::intrusive_ptr<InProgressOp> InProgressOpRef;
+ map<ceph_tid_t, InProgressOpRef> in_progress_ops;
public:
friend class C_OSD_OnOpCommit;
boost::optional<pg_hit_set_history_t> &hset_history,
InProgressOp *op,
ObjectStore::Transaction &op_t);
- void op_commit(InProgressOp *op);
+ void op_commit(InProgressOpRef& op);
void do_repop_reply(OpRequestRef op);
void do_repop(OpRequestRef op);