From 6b04b96991ab146a7b4007f5a650d71e5b0dc010 Mon Sep 17 00:00:00 2001 From: Radoslaw Zarzynski Date: Thu, 30 Sep 2021 09:53:50 +0000 Subject: [PATCH] crimson/osd: cancel IO reservations on PG::stop(). `PG::request_{local,remote}_recovery_reservation()` dynamically allocates up to 2 instances of `LambdaContext` and transfers their ownership to the `AsyncReserver`. This is expressed in raw pointers (`new` and `delete`) notion. Further analysis shows the only place where `delete` for these objects is called is the `AsyncReserver::cancel_reservation()`. In contrast to the classical OSD, crimson doesn't invoke the method when stopping a PG during the shutdown sequence. This would explain the following ASan issue observed at Sepia: ``` Direct leak of 576 byte(s) in 24 object(s) allocated from: #0 0x7fa108fc57b0 in operator new(unsigned long) (/lib64/libasan.so.5+0xf17b0) #1 0x55723d8b0b56 in non-virtual thunk to crimson::osd::PG::request_local_background_io_reservation(unsigned int, std::unique_ptr >, std::unique_ptr >) (/usr/bin/ceph-osd+0x24d95b56) #2 0x55723f1f66ef in PeeringState::WaitDeleteReserved::WaitDeleteReserved(boost::statechart::state, (boost::statechart::history_mode)0>::my_context) (/usr/bin/ceph-osd+0x266db6ef) ``` Signed-off-by: Radoslaw Zarzynski --- src/crimson/osd/pg.cc | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/crimson/osd/pg.cc b/src/crimson/osd/pg.cc index 704b6bf563a55..fe3fa195f223d 100644 --- a/src/crimson/osd/pg.cc +++ b/src/crimson/osd/pg.cc @@ -1153,6 +1153,8 @@ seastar::future<> PG::stop() { logger().info("PG {} {}", pgid, __func__); stopping = true; + cancel_local_background_io_reservation(); + cancel_remote_recovery_reservation(); check_readable_timer.cancel(); renew_lease_timer.cancel(); return osdmap_gate.stop().then([this] { -- 2.39.5