]> git.apps.os.sepia.ceph.com Git - ceph.git/commit
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)
commit70b16d5b012dfb5b5493e23a91999c4ff23fdf1c
tree26d56b98b62d72d06464cda1df01e470cece7851
parenta631510d4f669dbfa96fb6aa773d034e4d7ce4c2
crimson/osd: do not add ref when constructing MessageRef

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