]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
rbd-mirror: resolve potential recursive lock
authorMykola Golub <mgolub@mirantis.com>
Fri, 5 May 2017 09:56:50 +0000 (11:56 +0200)
committerMykola Golub <mgolub@mirantis.com>
Tue, 6 Jun 2017 08:42:25 +0000 (10:42 +0200)
Would have been possible when release_image had lead to cancel
sync (i.e. cancel_sync_request).

Signed-off-by: Mykola Golub <mgolub@mirantis.com>
src/tools/rbd_mirror/InstanceWatcher.cc

index 4bedf7009065d2e43954ffecc3261ab8f528c640..c42ee2fc1e07d717fa27c60e5a5cfe9c4e376e18 100644 (file)
@@ -785,8 +785,16 @@ void InstanceWatcher<I>::handle_image_acquire(
   const std::string &peer_image_id, Context *on_finish) {
   dout(20) << "global_image_id=" << global_image_id << dendl;
 
-  m_instance_replayer->acquire_image(global_image_id, peer_mirror_uuid,
-                                     peer_image_id, on_finish);
+  auto ctx = new FunctionContext(
+      [this, global_image_id, peer_mirror_uuid, peer_image_id,
+       on_finish] (int r) {
+        m_instance_replayer->acquire_image(global_image_id, peer_mirror_uuid,
+                                           peer_image_id, on_finish);
+        m_notify_op_tracker.finish_op();
+      });
+
+  m_notify_op_tracker.start_op();
+  m_work_queue->queue(ctx, 0);
 }
 
 template <typename I>
@@ -795,8 +803,17 @@ void InstanceWatcher<I>::handle_image_release(
   const std::string &peer_image_id, bool schedule_delete, Context *on_finish) {
   dout(20) << "global_image_id=" << global_image_id << dendl;
 
-  m_instance_replayer->release_image(global_image_id, peer_mirror_uuid,
-                                     peer_image_id, schedule_delete, on_finish);
+  auto ctx = new FunctionContext(
+      [this, global_image_id, peer_mirror_uuid, peer_image_id, schedule_delete,
+       on_finish] (int r) {
+        m_instance_replayer->release_image(global_image_id, peer_mirror_uuid,
+                                           peer_image_id, schedule_delete,
+                                           on_finish);
+        m_notify_op_tracker.finish_op();
+      });
+
+  m_notify_op_tracker.start_op();
+  m_work_queue->queue(ctx, 0);
 }
 
 template <typename I>