From e8b167e790131dbc2d121d570ca3786cd3ef1e48 Mon Sep 17 00:00:00 2001 From: luo rixin Date: Thu, 28 Jul 2022 15:52:09 +0800 Subject: [PATCH] crimson/osd/osd_operation: fix abort caused by op be deleted ahead There has tracked some history slow ops, when `num_slow_ops` is greater than `osd_op_history_slow_op_size`, the tracked fastest op should be deleted. In some case, the `fastest_historic_op` has refcount >= 2, the func `put_historic` decrease `fastest_historic_op's` refcount and still remain `fastest_historic_op` in `historic_registry`, `fastest_historic_op's` refcount will be decreased more than once in func `put_historic`, leading to `fastest_historic_op` be deleted ahead. So we need erase the `fastest_historic_op` from `historic_registry`. Signed-off-by: luo rixin --- src/crimson/osd/osd_operation.cc | 1 + 1 file changed, 1 insertion(+) diff --git a/src/crimson/osd/osd_operation.cc b/src/crimson/osd/osd_operation.cc index dec37d95433d4..63612091cc8b6 100644 --- a/src/crimson/osd/osd_operation.cc +++ b/src/crimson/osd/osd_operation.cc @@ -94,6 +94,7 @@ void OSDOperationRegistry::put_historic(const ClientRequest& op) assert(fastest_historic_iter != std::end(historic_registry)); const auto& fastest_historic_op = static_cast(*fastest_historic_iter); + historic_registry.erase(fastest_historic_iter); // clear a previously "leaked" op ClientRequest::ICRef(&fastest_historic_op, /* add_ref= */false); --num_slow_ops; -- 2.39.5