]> git.apps.os.sepia.ceph.com Git - ceph-ci.git/commitdiff
rbd-mirror: snapshot sync request needs to check for interruption
authorJason Dillaman <dillaman@redhat.com>
Fri, 20 Mar 2020 14:54:43 +0000 (10:54 -0400)
committerJason Dillaman <dillaman@redhat.com>
Fri, 20 Mar 2020 17:18:14 +0000 (13:18 -0400)
If the sync request was locally canceled, we need to resume the paused
shut down logic instead of just notifying the image replayer state
machine of the change -- since it had already requested a shut down and
will not re-request it.

Signed-off-by: Jason Dillaman <dillaman@redhat.com>
src/tools/rbd_mirror/image_replayer/snapshot/Replayer.cc

index 4cc2d1b78f9df5e55296adccd7fcdc14b62116de..69fb3d93af4d8355ac2a7997639c921eb1b62d23 100644 (file)
@@ -763,17 +763,21 @@ template <typename I>
 void Replayer<I>::handle_request_sync(int r) {
   dout(10) << "r=" << r << dendl;
 
-  if (r == -ECANCELED) {
+  std::unique_lock locker{m_lock};
+  if (is_replay_interrupted(&locker)) {
+    return;
+  } else if (r == -ECANCELED) {
     dout(5) << "image-sync canceled" << dendl;
-    handle_replay_complete(r, "image-sync canceled");
+    handle_replay_complete(&locker, r, "image-sync canceled");
     return;
   } else if (r < 0) {
     derr << "failed to request image-sync: " << cpp_strerror(r) << dendl;
-    handle_replay_complete(r, "failed to request image-sync");
+    handle_replay_complete(&locker, r, "failed to request image-sync");
     return;
   }
 
   m_sync_in_progress = true;
+  locker.unlock();
 
   copy_image();
 }