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>
(cherry picked from commit d30873b)
  • Loading branch information
Jason Dillaman authored and smithfarm committed Apr 13, 2017
1 parent eb84959 commit c223264
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/tools/rbd_mirror/ImageReplayer.cc
Expand Up @@ -604,6 +604,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 @@ -1058,6 +1059,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 c223264

Please sign in to comment.