diff options
author | Jason Dillaman <dillaman@redhat.com> | 2016-01-12 19:00:34 +0100 |
---|---|---|
committer | Jason Dillaman <dillaman@redhat.com> | 2016-01-12 19:00:34 +0100 |
commit | e59293d0cca21838b0c8c283ad9aabd4ea73dabf (patch) | |
tree | 37aae8fe3bb0d838fe7fd528e01aba3e6c88c758 /src/test/librbd/test_mock_ExclusiveLock.cc | |
parent | librbd: initialize object map before replaying journal (diff) | |
download | ceph-e59293d0cca21838b0c8c283ad9aabd4ea73dabf.tar.xz ceph-e59293d0cca21838b0c8c283ad9aabd4ea73dabf.zip |
librbd: add additional granularity to lock states
Allow all pre-release actions to see that the exclusive lock is
still owned and all post-acquire actions to see that the exclusive
lock is now owned.
Signed-off-by: Jason Dillaman <dillaman@redhat.com>
Diffstat (limited to 'src/test/librbd/test_mock_ExclusiveLock.cc')
-rw-r--r-- | src/test/librbd/test_mock_ExclusiveLock.cc | 12 |
1 files changed, 3 insertions, 9 deletions
diff --git a/src/test/librbd/test_mock_ExclusiveLock.cc b/src/test/librbd/test_mock_ExclusiveLock.cc index 56b2701295c..cac28a6c64a 100644 --- a/src/test/librbd/test_mock_ExclusiveLock.cc +++ b/src/test/librbd/test_mock_ExclusiveLock.cc @@ -17,12 +17,14 @@ namespace exclusive_lock { template<typename T> struct BaseRequest { static std::list<T *> s_requests; + Context *on_lock_unlock; Context *on_finish; static T* create(MockImageCtx &image_ctx, const std::string &cookie, - Context *on_finish) { + Context *on_lock_unlock, Context *on_finish) { assert(!s_requests.empty()); T* req = s_requests.front(); + req->on_lock_unlock = on_lock_unlock; req->on_finish = on_finish; s_requests.pop_front(); return req; @@ -87,21 +89,14 @@ public: .WillOnce(FinishRequest(&acquire_request, r, &mock_image_ctx)); if (r == 0) { expect_notify_acquired_lock(mock_image_ctx); - expect_unblock_writes(mock_image_ctx); } } void expect_release_lock(MockImageCtx &mock_image_ctx, MockReleaseRequest &release_request, int r, bool shutting_down = false) { - if (!shutting_down) { - expect_block_writes(mock_image_ctx); - } EXPECT_CALL(release_request, send()) .WillOnce(FinishRequest(&release_request, r, &mock_image_ctx)); - if (!shutting_down && r < 0) { - expect_unblock_writes(mock_image_ctx); - } if (r == 0) { expect_notify_released_lock(mock_image_ctx); expect_writes_empty(mock_image_ctx); @@ -506,7 +501,6 @@ TEST_F(TestMockExclusiveLock, ConcurrentRequests) { MockReleaseRequest release; C_SaferCond wait_for_send_ctx2; - expect_block_writes(mock_image_ctx); EXPECT_CALL(release, send()) .WillOnce(Notify(&wait_for_send_ctx2)); expect_notify_released_lock(mock_image_ctx); |