Skip to content

Commit

Permalink
rbd-mirror: avoid processing new events after stop requested
Browse files Browse the repository at this point in the history
Fixes: http://tracker.ceph.com/issues/18441
Signed-off-by: Jason Dillaman <dillaman@redhat.com>
  • Loading branch information
Jason Dillaman committed Jan 9, 2017
1 parent 30cfc81 commit d30873b
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/tools/rbd_mirror/ImageReplayer.cc
Expand Up @@ -605,6 +605,7 @@ void ImageReplayer<I>::on_start_fail(int r, const std::string &desc)
Context *ctx = new FunctionContext([this, r, desc](int _r) {
{
Mutex::Locker locker(m_lock);
assert(m_state == STATE_STARTING);
m_state = STATE_STOPPING;
if (r < 0 && r != -ECANCELED) {
derr << "start failed: " << cpp_strerror(r) << dendl;
Expand Down Expand Up @@ -1059,6 +1060,12 @@ void ImageReplayer<I>::process_entry() {
dout(20) << "processing entry tid=" << m_replay_entry.get_commit_tid()
<< dendl;

// stop replaying events if stop has been requested
if (on_replay_interrupted()) {
m_event_replay_tracker.finish_op();
return;
}

Context *on_ready = create_context_callback<
ImageReplayer, &ImageReplayer<I>::handle_process_entry_ready>(this);
Context *on_commit = new C_ReplayCommitted(this, std::move(m_replay_entry));
Expand Down

0 comments on commit d30873b

Please sign in to comment.