]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
osdc: Implement cancel mechanism for split ops.
authorAlex Ainscow <aainscow@uk.ibm.com>
Thu, 5 Feb 2026 14:04:30 +0000 (14:04 +0000)
committerJon Bailey <jonathan.bailey1@ibm.com>
Thu, 28 May 2026 14:15:50 +0000 (15:15 +0100)
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 <aainscow@uk.ibm.com>
src/osdc/Objecter.cc
src/osdc/Objecter.h

index 67b94279a4a4cc9cd6e7f86d769a0407c5621eef..2cac28977eb344593fb56ec05760158baaa122a1 100644 (file)
@@ -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();
index 0f00ceae73d05963c8a4e3d2cb7428bae0ec30de..193902d840643a0d9733b4491a19591e3f550b0f 100644 (file)
@@ -2035,6 +2035,7 @@ public:
     uint64_t ontimeout = 0;
 
     ceph_tid_t tid = 0;
+    std::unique_ptr<std::vector<ceph_tid_t>> split_op_tids;
     int attempts = 0;
 
     version_t *objver;