Skip to content

Commit

Permalink
rbd-mirror: return ECANCELED when ImageReplayer start is canceled
Browse files Browse the repository at this point in the history
Signed-off-by: Mykola Golub <mgolub@mirantis.com>
  • Loading branch information
Mykola Golub committed Jun 5, 2016
1 parent 3c83ab2 commit f581dbc
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
4 changes: 2 additions & 2 deletions src/test/rbd_mirror/test_ImageReplayer.cc
Expand Up @@ -395,8 +395,8 @@ TEST_F(TestImageReplayer, StartInterrupted)
m_replayer->stop(&stop_cond);
int r = start_cond.wait();
printf("start returned %d\n", r);
// TODO: improve the test to avoid this race // TODO: improve the test to avoid this race
ASSERT_TRUE(r == -EINTR || r == 0);
// TODO: improve the test to avoid this race
ASSERT_TRUE(r == -ECANCELED || r == 0);
ASSERT_EQ(0, stop_cond.wait());
}

Expand Down
6 changes: 3 additions & 3 deletions src/tools/rbd_mirror/ImageReplayer.cc
Expand Up @@ -512,10 +512,10 @@ void ImageReplayer<I>::on_start_fail(int r, const std::string &desc)
{
Mutex::Locker locker(m_lock);
m_state = STATE_STOPPING;
if (r < 0 && r != -EINTR) {
if (r < 0 && r != -ECANCELED) {
derr << "start failed: " << cpp_strerror(r) << dendl;
} else {
dout(20) << "start interrupted" << dendl;
dout(20) << "start canceled" << dendl;
}
std::swap(m_on_start_finish, on_start_finish);
}
Expand All @@ -536,7 +536,7 @@ bool ImageReplayer<I>::on_start_interrupted()
return false;
}

on_start_fail(-EINTR);
on_start_fail(-ECANCELED);
return true;
}

Expand Down

0 comments on commit f581dbc

Please sign in to comment.