]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
librbd: memory leak in MirroringWatcher::notify_image_updated 11306/head
authorMykola Golub <mgolub@mirantis.com>
Tue, 4 Oct 2016 12:54:09 +0000 (15:54 +0300)
committerMykola Golub <mgolub@mirantis.com>
Tue, 4 Oct 2016 12:54:09 +0000 (15:54 +0300)
Signed-off-by: Mykola Golub <mgolub@mirantis.com>
src/librbd/MirroringWatcher.cc
src/librbd/MirroringWatcher.h

index d142ae3593bf2aa3649c171ae14cdd4424aa7b38..ffed247cfc8e4e4a1c6e833252d5f32bc0a36c34 100644 (file)
@@ -61,7 +61,7 @@ int MirroringWatcher<I>::notify_image_updated(
 }
 
 template <typename I>
-int MirroringWatcher<I>::notify_image_updated(
+void MirroringWatcher<I>::notify_image_updated(
     librados::IoCtx &io_ctx, cls::rbd::MirrorImageState mirror_image_state,
     const std::string &image_id, const std::string &global_image_id,
     Context *on_finish) {
@@ -75,12 +75,8 @@ int MirroringWatcher<I>::notify_image_updated(
   librados::AioCompletion *comp = util::create_rados_ack_callback(on_finish);
   int r = io_ctx.aio_notify(RBD_MIRRORING, comp, bl, NOTIFY_TIMEOUT_MS,
                             nullptr);
-  if (r < 0) {
-    lderr(cct) << ": error encountered sending image updated notification: "
-               << cpp_strerror(r) << dendl;
-    return r;
-  }
-  return 0;
+  assert(r == 0);
+  comp->release();
 }
 
 template <typename I>
index 9111682a2e2f0d974c51b4ea1484781b79dfb373..09155c42aae55b7c76c377f49df9394948570385 100644 (file)
@@ -29,11 +29,11 @@ public:
                                   cls::rbd::MirrorImageState mirror_image_state,
                                   const std::string &image_id,
                                   const std::string &global_image_id);
-  static int notify_image_updated(librados::IoCtx &io_ctx,
-                                  cls::rbd::MirrorImageState mirror_image_state,
-                                  const std::string &image_id,
-                                  const std::string &global_image_id,
-                                  Context *on_finish);
+  static void notify_image_updated(librados::IoCtx &io_ctx,
+                                   cls::rbd::MirrorImageState mirror_image_state,
+                                   const std::string &image_id,
+                                   const std::string &global_image_id,
+                                   Context *on_finish);
 
   virtual void handle_mode_updated(cls::rbd::MirrorMode mirror_mode,
                                    Context *on_ack) = 0;