From: Alex Ainscow Date: Thu, 5 Feb 2026 14:04:30 +0000 (+0000) Subject: osdc: Implement cancel mechanism for split ops. X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=9a8063b46e9db2fd0fe178743a66208d73c0e37f;p=ceph.git osdc: Implement cancel mechanism for split ops. When an op that has been split is canceled or timed out, all the sub ops need to be canceled. This commit adds a mechanism to map the original op to the sub reads. Signed-off-by: Alex Ainscow --- diff --git a/src/osdc/Objecter.cc b/src/osdc/Objecter.cc index 67b94279a4a..2cac28977eb 100644 --- a/src/osdc/Objecter.cc +++ b/src/osdc/Objecter.cc @@ -2708,9 +2708,28 @@ int Objecter::op_cancel(OSDSession *s, ceph_tid_t tid, int r, } #endif + Op *op = p->second; + if (op->split_op_tids) { + auto tids = *op->split_op_tids; // intentional copy. + sl.unlock(); + + // An op with split ops is not actually active, but has child ops which + // need to be canceled. This op should end up being canceled by the + // generated completions. + for (auto sub_tid : tids) { + ldout(cct, 10) << __func__ << " SplitOp:: cancel tid " << tid + << " sub_tid " << sub_tid + << " in session " << s->osd << dendl; + int ret = _op_cancel(sub_tid, r); + if (ret != 0) { + ldout(cct, 20) << __func__ << " unexpected error canceling sub_tid " + << sub_tid << ": " << ret << dendl; + } + } + return 0; + } ldout(cct, 10) << __func__ << " tid " << tid << " in session " << s->osd << dendl; - Op *op = p->second; if (op->has_completion()) { num_in_flight--; op->complete(ec, r, service.get_executor()); @@ -3368,7 +3387,8 @@ void Objecter::_session_op_remove(OSDSession *from, Op *op) num_homeless_ops--; } - from->ops.erase(op->tid); + size_t result = from->ops.erase(op->tid); + ceph_assert(result != 0); put_session(from); op->session = NULL; @@ -3509,6 +3529,7 @@ void Objecter::_finish_op(Op *op, int r) ceph_assert(check_latest_map_ops.find(op->tid) == check_latest_map_ops.end()); + ceph_assert(inflight_ops > 0); inflight_ops--; op->put(); diff --git a/src/osdc/Objecter.h b/src/osdc/Objecter.h index 0f00ceae73d..193902d8406 100644 --- a/src/osdc/Objecter.h +++ b/src/osdc/Objecter.h @@ -2035,6 +2035,7 @@ public: uint64_t ontimeout = 0; ceph_tid_t tid = 0; + std::unique_ptr> split_op_tids; int attempts = 0; version_t *objver;