]> git.apps.os.sepia.ceph.com Git - ceph-ci.git/commitdiff
crimson/osd/osd_operation/client_request: requeue client requests from a
authorXuehan Xu <xuxuehan@qianxin.com>
Mon, 22 Jul 2024 06:03:25 +0000 (14:03 +0800)
committerXuehan Xu <xuxuehan@qianxin.com>
Mon, 22 Jul 2024 06:15:52 +0000 (14:15 +0800)
temporary queue other than ClientRequest::Orderer::list

This avoids the possible destructions of client requests during the
iteration of ClientRequest::Orderer::list

Fixes: https://tracker.ceph.com/issues/67068
Signed-off-by: Xuehan Xu <xuxuehan@qianxin.com>
src/crimson/osd/osd_operations/client_request.cc

index 4a721d1277fb6994f24dfda2ccc0c5401716bcb0..dcb1e5e1403efe30af2aa51e73488c4dbc9d21f3 100644 (file)
@@ -23,10 +23,18 @@ namespace crimson::osd {
 void ClientRequest::Orderer::requeue(Ref<PG> pg)
 {
   LOG_PREFIX(ClientRequest::Orderer::requeue);
-  for (auto &req: list) {
-    DEBUGDPP("requeueing {}", *pg, req);
-    req.reset_instance_handle();
-    std::ignore = req.with_pg_process(pg);
+  std::list<ClientRequest*> to_requeue;
+  for (auto &req : list) {
+    to_requeue.emplace_back(&req);
+  }
+  // Client requests might be destroyed in the following
+  // iteration leading to short lived dangling pointers
+  // to those requests, but this doesn't hurt as we won't
+  // dereference those dangling pointers.
+  for (auto req: to_requeue) {
+    DEBUGDPP("requeueing {}", *pg, *req);
+    req->reset_instance_handle();
+    std::ignore = req->with_pg_process(pg);
   }
 }