]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
crimson/osd: do not add ref when constructing MessageRef
authorKefu Chai <kchai@redhat.com>
Tue, 22 Sep 2020 09:03:17 +0000 (17:03 +0800)
committerKefu Chai <kchai@redhat.com>
Tue, 22 Sep 2020 09:13:21 +0000 (17:13 +0800)
crimson::osd::PG::send_cluster_message() accepts a `Message*`
pointer, and then hand it over to `shard_services.send_to_osd()`,
which expects a `Ref<Message>`. so the raw pointer is used to
construct an `intrusive_ptr<Message>`, which increment the
refcount of that Message instance by one. but that Message
was owned by nobody before that, so we end up with an
`intrusive_ptr<Message>` of 2 refcount, and only a single
owner. hence the memory leak.

in this change, instructs the constructor to not add the refcount.

Signed-off-by: Kefu Chai <kchai@redhat.com>
src/crimson/osd/pg.h

index d754d18e8c7540cbb3bef4a75b99873f0de2cda7..3b193697ae45d8dca96e0e18e6c89b7507e9ff0c 100644 (file)
@@ -159,7 +159,7 @@ public:
   void send_cluster_message(
     int osd, Message *m,
     epoch_t epoch, bool share_map_update=false) final {
-    (void)shard_services.send_to_osd(osd, m, epoch);
+    (void)shard_services.send_to_osd(osd, MessageRef{m, false}, epoch);
   }
 
   void send_pg_created(pg_t pgid) final {