]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commit
osd,crimson/osd: pass message using intrusive_ptr<> 37304/head
authorKefu Chai <kchai@redhat.com>
Tue, 22 Sep 2020 08:11:24 +0000 (16:11 +0800)
committerKefu Chai <kchai@redhat.com>
Wed, 23 Sep 2020 14:54:51 +0000 (22:54 +0800)
commitd4a71c3c5369c7a881822a6eb7624e3e80cc53de
tree3c5af686d50d869443a1383dd8ab97028d25fcaf
parenta433ed128209058996719a7d025289424cf3c767
osd,crimson/osd: pass message using intrusive_ptr<>

for two reasons:

* 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.
* osd: to use Connection::send_message2(), which accepts
  MessageRef and less error-prone in the sense of preventing
  memory leak of Messages.

Signed-off-by: Kefu Chai <kchai@redhat.com>
src/crimson/osd/pg.h
src/osd/OSD.h
src/osd/PG.cc
src/osd/PG.h
src/osd/PGBackend.cc
src/osd/PGBackend.h
src/osd/PeeringState.cc
src/osd/PeeringState.h
src/osd/PrimaryLogPG.h
src/osd/ReplicatedBackend.cc