From: Ilya Dryomov Date: Wed, 13 Apr 2022 13:24:04 +0000 (+0200) Subject: test/rbd_mirror: grab timer lock before calling add_event_after() X-Git-Tag: v18.0.0~1063^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=refs%2Fpull%2F45897%2Fhead;p=ceph.git test/rbd_mirror: grab timer lock before calling add_event_after() add_event_after() expects an externally provided mutex to be held for the call. This was missed in commit 8965a0f2a6f7 ("rbd-mirror: synchronize with in-flight stop in ImageReplayer::stop()"). Fixes: https://tracker.ceph.com/issues/55317 Signed-off-by: Ilya Dryomov --- diff --git a/src/test/rbd_mirror/test_mock_ImageReplayer.cc b/src/test/rbd_mirror/test_mock_ImageReplayer.cc index c19d4923ab96..177b71a15848 100644 --- a/src/test/rbd_mirror/test_mock_ImageReplayer.cc +++ b/src/test/rbd_mirror/test_mock_ImageReplayer.cc @@ -880,6 +880,7 @@ TEST_F(TestMockImageReplayer, StopJoinInterruptedReplayer) { const double DELAY = 10; EXPECT_CALL(mock_replayer, shut_down(_)) .WillOnce(Invoke([this, DELAY](Context* ctx) { + std::lock_guard l(m_threads->timer_lock); m_threads->timer->add_event_after(DELAY, ctx); })); EXPECT_CALL(mock_replayer, destroy()); @@ -927,6 +928,7 @@ TEST_F(TestMockImageReplayer, StopJoinRequestedStop) { const double DELAY = 10; EXPECT_CALL(mock_replayer, shut_down(_)) .WillOnce(Invoke([this, DELAY](Context* ctx) { + std::lock_guard l(m_threads->timer_lock); m_threads->timer->add_event_after(DELAY, ctx); })); EXPECT_CALL(mock_replayer, destroy());