From: Radoslaw Zarzynski Date: Thu, 30 Sep 2021 09:53:50 +0000 (+0000) Subject: crimson/osd: cancel IO reservations on PG::stop(). X-Git-Tag: v17.1.0~777^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=refs%2Fpull%2F43364%2Fhead;p=ceph.git 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 --- diff --git a/src/crimson/osd/pg.cc b/src/crimson/osd/pg.cc index 704b6bf563a5..fe3fa195f223 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] {