diff --git a/src/librbd/CMakeLists.txt b/src/librbd/CMakeLists.txt index 0b224ce15df..e1739aa54af 100644 --- a/src/librbd/CMakeLists.txt +++ b/src/librbd/CMakeLists.txt @@ -37,6 +37,7 @@ set(librbd_internal_srcs managed_lock/GetLockerRequest.cc managed_lock/ReleaseRequest.cc managed_lock/ReacquireRequest.cc + managed_lock/Utils.cc exclusive_lock/AutomaticPolicy.cc exclusive_lock/PreAcquireRequest.cc exclusive_lock/PostAcquireRequest.cc diff --git a/src/librbd/ManagedLock.cc b/src/librbd/ManagedLock.cc index 18f33e184ab..67504a9b3ec 100644 --- a/src/librbd/ManagedLock.cc +++ b/src/librbd/ManagedLock.cc @@ -8,6 +8,7 @@ #include "librbd/managed_lock/ReleaseRequest.h" #include "librbd/managed_lock/ReacquireRequest.h" #include "librbd/managed_lock/Types.h" +#include "librbd/managed_lock/Utils.h" #include "librbd/Watcher.h" #include "librbd/ImageCtx.h" #include "cls/lock/cls_lock_client.h" @@ -15,7 +16,6 @@ #include "common/errno.h" #include "common/WorkQueue.h" #include "librbd/Utils.h" -#include #define dout_subsys ceph_subsys_rbd #undef dout_prefix @@ -28,8 +28,6 @@ using namespace managed_lock; namespace { -const std::string WATCHER_LOCK_COOKIE_PREFIX = "auto"; - template struct C_SendLockRequest : public Context { R* request; @@ -42,15 +40,17 @@ struct C_SendLockRequest : public Context { } // anonymous namespace -template -const std::string ManagedLock::WATCHER_LOCK_TAG("internal"); +using librbd::util::create_context_callback; +using librbd::util::unique_lock_name; +using managed_lock::util::decode_lock_cookie; +using managed_lock::util::encode_lock_cookie; template ManagedLock::ManagedLock(librados::IoCtx &ioctx, ContextWQ *work_queue, const string& oid, Watcher *watcher, Mode mode, bool blacklist_on_break_lock, uint32_t blacklist_expire_seconds) - : m_lock(util::unique_lock_name("librbd::ManagedLock::m_lock", this)), + : m_lock(unique_lock_name("librbd::ManagedLock::m_lock", this)), m_state(STATE_UNLOCKED), m_ioctx(ioctx), m_cct(reinterpret_cast(ioctx.cct())), m_work_queue(work_queue), @@ -253,25 +253,6 @@ void ManagedLock::post_release_lock_handler(bool shutting_down, int r, on_finish->complete(r); } -template -bool ManagedLock::decode_lock_cookie(const std::string &tag, - uint64_t *handle) { - std::string prefix; - std::istringstream ss(tag); - if (!(ss >> prefix >> *handle) || prefix != WATCHER_LOCK_COOKIE_PREFIX) { - return false; - } - return true; -} - -template -string ManagedLock::encode_lock_cookie(uint64_t watch_handle) { - assert(watch_handle != 0); - std::ostringstream ss; - ss << WATCHER_LOCK_COOKIE_PREFIX << " " << watch_handle; - return ss.str(); -} - template bool ManagedLock::is_transition_state() const { switch (m_state) { @@ -402,10 +383,10 @@ void ManagedLock::send_acquire_lock() { m_state = STATE_WAITING_FOR_REGISTER; return; } - m_cookie = ManagedLock::encode_lock_cookie(watch_handle); + m_cookie = encode_lock_cookie(watch_handle); m_work_queue->queue(new FunctionContext([this](int r) { - pre_acquire_lock_handler(util::create_context_callback< + pre_acquire_lock_handler(create_context_callback< ManagedLock, &ManagedLock::handle_pre_acquire_lock>(this)); })); } @@ -423,7 +404,7 @@ void ManagedLock::handle_pre_acquire_lock(int r) { AcquireRequest* req = AcquireRequest::create( m_ioctx, m_watcher, m_work_queue, m_oid, m_cookie, m_mode == EXCLUSIVE, m_blacklist_on_break_lock, m_blacklist_expire_seconds, - util::create_context_callback< + create_context_callback< ManagedLock, &ManagedLock::handle_acquire_lock>(this)); m_work_queue->queue(new C_SendLockRequest>(req), 0); } @@ -444,7 +425,7 @@ void ManagedLock::handle_acquire_lock(int r) { m_post_next_state = (r < 0 ? STATE_UNLOCKED : STATE_LOCKED); m_work_queue->queue(new FunctionContext([this, r](int ret) { - post_acquire_lock_handler(r, util::create_context_callback< + post_acquire_lock_handler(r, create_context_callback< ManagedLock, &ManagedLock::handle_post_acquire_lock>(this)); })); } @@ -496,7 +477,7 @@ void ManagedLock::send_reacquire_lock() { return; } - m_new_cookie = ManagedLock::encode_lock_cookie(watch_handle); + m_new_cookie = encode_lock_cookie(watch_handle); if (m_cookie == m_new_cookie) { ldout(m_cct, 10) << ": skipping reacquire since cookie still valid" << dendl; @@ -510,7 +491,7 @@ void ManagedLock::send_reacquire_lock() { using managed_lock::ReacquireRequest; ReacquireRequest* req = ReacquireRequest::create(m_ioctx, m_oid, m_cookie, m_new_cookie, m_mode == EXCLUSIVE, - util::create_context_callback< + create_context_callback< ManagedLock, &ManagedLock::handle_reacquire_lock>(this)); m_work_queue->queue(new C_SendLockRequest>(req)); } @@ -574,7 +555,7 @@ void ManagedLock::send_release_lock() { m_state = STATE_PRE_RELEASING; m_work_queue->queue(new FunctionContext([this](int r) { - pre_release_lock_handler(false, util::create_context_callback< + pre_release_lock_handler(false, create_context_callback< ManagedLock, &ManagedLock::handle_pre_release_lock>(this)); })); } @@ -591,7 +572,7 @@ void ManagedLock::handle_pre_release_lock(int r) { using managed_lock::ReleaseRequest; ReleaseRequest* req = ReleaseRequest::create(m_ioctx, m_watcher, m_work_queue, m_oid, m_cookie, - util::create_context_callback< + create_context_callback< ManagedLock, &ManagedLock::handle_release_lock>(this)); m_work_queue->queue(new C_SendLockRequest>(req), 0); } @@ -610,7 +591,7 @@ void ManagedLock::handle_release_lock(int r) { m_post_next_state = r < 0 ? STATE_LOCKED : STATE_UNLOCKED; m_work_queue->queue(new FunctionContext([this, r](int ret) { - post_release_lock_handler(false, r, util::create_context_callback< + post_release_lock_handler(false, r, create_context_callback< ManagedLock, &ManagedLock::handle_post_release_lock>(this)); })); } @@ -630,7 +611,7 @@ void ManagedLock::send_shutdown() { if (m_state == STATE_UNLOCKED) { m_state = STATE_SHUTTING_DOWN; m_work_queue->queue(new FunctionContext([this](int r) { - shutdown_handler(r, util::create_context_callback< + shutdown_handler(r, create_context_callback< ManagedLock, &ManagedLock::handle_shutdown>(this)); })); return; @@ -659,7 +640,7 @@ void ManagedLock::send_shutdown_release() { Mutex::Locker locker(m_lock); m_work_queue->queue(new FunctionContext([this](int r) { - pre_release_lock_handler(true, util::create_context_callback< + pre_release_lock_handler(true, create_context_callback< ManagedLock, &ManagedLock::handle_shutdown_pre_release>(this)); })); } @@ -678,7 +659,7 @@ void ManagedLock::handle_shutdown_pre_release(int r) { ReleaseRequest* req = ReleaseRequest::create(m_ioctx, m_watcher, m_work_queue, m_oid, cookie, new FunctionContext([this](int r) { - post_release_lock_handler(true, r, util::create_context_callback< + post_release_lock_handler(true, r, create_context_callback< ManagedLock, &ManagedLock::handle_shutdown_post_release>(this)); })); req->send(); diff --git a/src/librbd/ManagedLock.h b/src/librbd/ManagedLock.h index 45f06b4978e..baa28fdd4dc 100644 --- a/src/librbd/ManagedLock.h +++ b/src/librbd/ManagedLock.h @@ -30,8 +30,6 @@ private: typedef typename TypeTraits::Watcher Watcher; public: - static const std::string WATCHER_LOCK_TAG; - static ManagedLock *create(librados::IoCtx& ioctx, ContextWQ *work_queue, const std::string& oid, Watcher *watcher, managed_lock::Mode mode, @@ -67,8 +65,6 @@ public: return m_state == STATE_LOCKED; } - static bool decode_lock_cookie(const std::string &tag, uint64_t *handle); - protected: /** @@ -174,8 +170,6 @@ private: ActionsContexts m_actions_contexts; - static std::string encode_lock_cookie(uint64_t watch_handle); - bool is_lock_owner(Mutex &lock) const; bool is_transition_state() const; diff --git a/src/librbd/exclusive_lock/PostAcquireRequest.cc b/src/librbd/exclusive_lock/PostAcquireRequest.cc index 0ac4056bb81..3e262e79291 100644 --- a/src/librbd/exclusive_lock/PostAcquireRequest.cc +++ b/src/librbd/exclusive_lock/PostAcquireRequest.cc @@ -9,7 +9,6 @@ #include "common/WorkQueue.h" #include "include/stringify.h" #include "librbd/ExclusiveLock.h" -#include "librbd/ManagedLock.h" #include "librbd/ImageCtx.h" #include "librbd/ImageState.h" #include "librbd/ImageWatcher.h" diff --git a/src/librbd/exclusive_lock/PostAcquireRequest.h b/src/librbd/exclusive_lock/PostAcquireRequest.h index 92d2da9abcd..06fdce394bc 100644 --- a/src/librbd/exclusive_lock/PostAcquireRequest.h +++ b/src/librbd/exclusive_lock/PostAcquireRequest.h @@ -14,9 +14,6 @@ class Context; namespace librbd { -template class Journal; -template class ManagedLock; - namespace exclusive_lock { template diff --git a/src/librbd/exclusive_lock/PreReleaseRequest.cc b/src/librbd/exclusive_lock/PreReleaseRequest.cc index 7fecb818049..5096ed8189c 100644 --- a/src/librbd/exclusive_lock/PreReleaseRequest.cc +++ b/src/librbd/exclusive_lock/PreReleaseRequest.cc @@ -6,7 +6,6 @@ #include "common/errno.h" #include "librbd/AioImageRequestWQ.h" #include "librbd/ExclusiveLock.h" -#include "librbd/ManagedLock.h" #include "librbd/ImageState.h" #include "librbd/ImageWatcher.h" #include "librbd/Journal.h" diff --git a/src/librbd/exclusive_lock/PreReleaseRequest.h b/src/librbd/exclusive_lock/PreReleaseRequest.h index 15f40b92254..0fda36a091a 100644 --- a/src/librbd/exclusive_lock/PreReleaseRequest.h +++ b/src/librbd/exclusive_lock/PreReleaseRequest.h @@ -12,8 +12,6 @@ class Context; namespace librbd { struct ImageCtx; -template class ManagedLock; -template class Journal; namespace exclusive_lock { diff --git a/src/librbd/managed_lock/AcquireRequest.cc b/src/librbd/managed_lock/AcquireRequest.cc index d40b0c0dbfa..b89f658275f 100644 --- a/src/librbd/managed_lock/AcquireRequest.cc +++ b/src/librbd/managed_lock/AcquireRequest.cc @@ -3,18 +3,17 @@ #include "librbd/managed_lock/AcquireRequest.h" #include "librbd/Watcher.h" -#include "librbd/ManagedLock.h" #include "cls/lock/cls_lock_client.h" #include "cls/lock/cls_lock_types.h" #include "common/dout.h" #include "common/errno.h" #include "common/WorkQueue.h" #include "include/stringify.h" +#include "librbd/ImageCtx.h" #include "librbd/Utils.h" #include "librbd/managed_lock/BreakRequest.h" #include "librbd/managed_lock/GetLockerRequest.h" - -#include "librbd/ImageCtx.h" +#include "librbd/managed_lock/Utils.h" #define dout_subsys ceph_subsys_rbd #undef dout_prefix @@ -25,10 +24,10 @@ using std::string; namespace librbd { -using util::detail::C_AsyncCallback; -using util::create_context_callback; -using util::create_rados_safe_callback; -using util::create_rados_ack_callback; +using librbd::util::detail::C_AsyncCallback; +using librbd::util::create_context_callback; +using librbd::util::create_rados_safe_callback; +using librbd::util::create_rados_ack_callback; namespace managed_lock { @@ -110,7 +109,7 @@ void AcquireRequest::send_lock() { librados::ObjectWriteOperation op; rados::cls::lock::lock(&op, RBD_LOCK_NAME, m_exclusive ? LOCK_EXCLUSIVE : LOCK_SHARED, m_cookie, - ManagedLock::WATCHER_LOCK_TAG, "", utime_t(), 0); + util::get_watcher_lock_tag(), "", utime_t(), 0); using klass = AcquireRequest; librados::AioCompletion *rados_completion = diff --git a/src/librbd/managed_lock/GetLockerRequest.cc b/src/librbd/managed_lock/GetLockerRequest.cc index 9f93d305c04..2a37d95505f 100644 --- a/src/librbd/managed_lock/GetLockerRequest.cc +++ b/src/librbd/managed_lock/GetLockerRequest.cc @@ -8,9 +8,9 @@ #include "common/errno.h" #include "include/stringify.h" #include "librbd/ImageCtx.h" -#include "librbd/ManagedLock.h" #include "librbd/Utils.h" #include "librbd/managed_lock/Types.h" +#include "librbd/managed_lock/Utils.h" #define dout_subsys ceph_subsys_rbd #undef dout_prefix @@ -20,7 +20,7 @@ namespace librbd { namespace managed_lock { -using util::create_rados_ack_callback; +using librbd::util::create_rados_ack_callback; template GetLockerRequest::GetLockerRequest(librados::IoCtx& ioctx, @@ -78,7 +78,7 @@ void GetLockerRequest::handle_get_lockers(int r) { return; } - if (lock_tag != ManagedLock<>::WATCHER_LOCK_TAG) { + if (lock_tag != util::get_watcher_lock_tag()) { ldout(m_cct, 5) <<"locked by external mechanism: tag=" << lock_tag << dendl; finish(-EBUSY); return; @@ -96,8 +96,7 @@ void GetLockerRequest::handle_get_lockers(int r) { std::map::iterator iter = lockers.begin(); - if (!ManagedLock<>::decode_lock_cookie(iter->first.cookie, - &m_locker->handle)) { + if (!util::decode_lock_cookie(iter->first.cookie, &m_locker->handle)) { ldout(m_cct, 5) << "locked by external mechanism: " << "cookie=" << iter->first.cookie << dendl; finish(-EBUSY); diff --git a/src/librbd/managed_lock/ReacquireRequest.cc b/src/librbd/managed_lock/ReacquireRequest.cc index 02c564d7ff4..83c39d85521 100644 --- a/src/librbd/managed_lock/ReacquireRequest.cc +++ b/src/librbd/managed_lock/ReacquireRequest.cc @@ -3,14 +3,13 @@ #include "librbd/managed_lock/ReacquireRequest.h" #include "librbd/Watcher.h" -#include "librbd/ManagedLock.h" #include "cls/lock/cls_lock_client.h" #include "cls/lock/cls_lock_types.h" #include "common/dout.h" #include "common/errno.h" -#include "librbd/Utils.h" - #include "librbd/ImageCtx.h" +#include "librbd/Utils.h" +#include "librbd/managed_lock/Utils.h" #define dout_subsys ceph_subsys_rbd #undef dout_prefix @@ -49,7 +48,7 @@ void ReacquireRequest::set_cookie() { librados::ObjectWriteOperation op; rados::cls::lock::set_cookie(&op, RBD_LOCK_NAME, m_exclusive ? LOCK_EXCLUSIVE : LOCK_SHARED, - m_old_cookie, ManagedLock::WATCHER_LOCK_TAG, + m_old_cookie, util::get_watcher_lock_tag(), m_new_cookie); librados::AioCompletion *rados_completion = create_rados_safe_callback< diff --git a/src/librbd/managed_lock/Utils.cc b/src/librbd/managed_lock/Utils.cc new file mode 100644 index 00000000000..64210beb74e --- /dev/null +++ b/src/librbd/managed_lock/Utils.cc @@ -0,0 +1,43 @@ +// -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*- +// vim: ts=8 sw=2 smarttab + +#include "include/assert.h" +#include "librbd/managed_lock/Utils.h" +#include + +namespace librbd { +namespace managed_lock { +namespace util { + +namespace { + +const std::string WATCHER_LOCK_COOKIE_PREFIX = "auto"; +const std::string WATCHER_LOCK_TAG("internal"); + +} // anonymous namespace + +const std::string &get_watcher_lock_tag() { + return WATCHER_LOCK_TAG; +} + +bool decode_lock_cookie(const std::string &tag, uint64_t *handle) { + std::string prefix; + std::istringstream ss(tag); + if (!(ss >> prefix >> *handle) || prefix != WATCHER_LOCK_COOKIE_PREFIX) { + return false; + } + return true; +} + +std::string encode_lock_cookie(uint64_t watch_handle) { + assert(watch_handle != 0); + std::ostringstream ss; + ss << WATCHER_LOCK_COOKIE_PREFIX << " " << watch_handle; + return ss.str(); +} + +} // namespace util +} // namespace managed_lock +} // namespace librbd + + diff --git a/src/librbd/managed_lock/Utils.h b/src/librbd/managed_lock/Utils.h new file mode 100644 index 00000000000..679cbfe8e4c --- /dev/null +++ b/src/librbd/managed_lock/Utils.h @@ -0,0 +1,23 @@ +// -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*- +// vim: ts=8 sw=2 smarttab + +#ifndef CEPH_LIBRBD_MANAGED_LOCK_UTILS_H +#define CEPH_LIBRBD_MANAGED_LOCK_UTILS_H + +#include "include/int_types.h" +#include + +namespace librbd { +namespace managed_lock { +namespace util { + +const std::string &get_watcher_lock_tag(); + +bool decode_lock_cookie(const std::string &tag, uint64_t *handle); +std::string encode_lock_cookie(uint64_t watch_handle); + +} // namespace util +} // namespace managed_lock +} // namespace librbd + +#endif // CEPH_LIBRBD_MANAGED_LOCK_UTILS_H diff --git a/src/test/librbd/exclusive_lock/test_mock_PreReleaseRequest.cc b/src/test/librbd/exclusive_lock/test_mock_PreReleaseRequest.cc index 45943aebcdc..b94ab914042 100644 --- a/src/test/librbd/exclusive_lock/test_mock_PreReleaseRequest.cc +++ b/src/test/librbd/exclusive_lock/test_mock_PreReleaseRequest.cc @@ -18,8 +18,6 @@ template class librbd::exclusive_lock::PreReleaseRequest; namespace librbd { -using librbd::ManagedLock; - namespace exclusive_lock { namespace { diff --git a/src/test/librbd/managed_lock/test_mock_AcquireRequest.cc b/src/test/librbd/managed_lock/test_mock_AcquireRequest.cc index 5ea9ada6a04..4860b0385cb 100644 --- a/src/test/librbd/managed_lock/test_mock_AcquireRequest.cc +++ b/src/test/librbd/managed_lock/test_mock_AcquireRequest.cc @@ -81,9 +81,6 @@ GetLockerRequest *GetLockerRequest:: #include "librbd/managed_lock/AcquireRequest.cc" template class librbd::managed_lock::AcquireRequest; -#include "librbd/ManagedLock.cc" -template class librbd::ManagedLock; - namespace { MATCHER_P(IsLockType, exclusive, "") { @@ -116,7 +113,6 @@ public: typedef AcquireRequest MockAcquireRequest; typedef BreakRequest MockBreakRequest; typedef GetLockerRequest MockGetLockerRequest; - typedef ManagedLock MockManagedLock; void expect_lock(MockImageCtx &mock_image_ctx, int r, bool exclusive = true) { diff --git a/src/test/librbd/managed_lock/test_mock_BreakRequest.cc b/src/test/librbd/managed_lock/test_mock_BreakRequest.cc index df6b04e5d48..947ea1f731d 100644 --- a/src/test/librbd/managed_lock/test_mock_BreakRequest.cc +++ b/src/test/librbd/managed_lock/test_mock_BreakRequest.cc @@ -7,7 +7,6 @@ #include "test/librados_test_stub/MockTestMemIoCtxImpl.h" #include "test/librados_test_stub/MockTestMemRadosClient.h" #include "cls/lock/cls_lock_ops.h" -#include "librbd/ManagedLock.h" #include "librbd/managed_lock/BreakRequest.h" #include "gmock/gmock.h" #include "gtest/gtest.h" diff --git a/src/test/librbd/managed_lock/test_mock_GetLockerRequest.cc b/src/test/librbd/managed_lock/test_mock_GetLockerRequest.cc index e8b1ec76d3d..c339427106f 100644 --- a/src/test/librbd/managed_lock/test_mock_GetLockerRequest.cc +++ b/src/test/librbd/managed_lock/test_mock_GetLockerRequest.cc @@ -7,9 +7,9 @@ #include "test/librados_test_stub/MockTestMemIoCtxImpl.h" #include "test/librados_test_stub/MockTestMemRadosClient.h" #include "cls/lock/cls_lock_ops.h" -#include "librbd/ManagedLock.h" #include "librbd/managed_lock/GetLockerRequest.h" #include "librbd/managed_lock/Types.h" +#include "librbd/managed_lock/Utils.h" #include "gmock/gmock.h" #include "gtest/gtest.h" #include @@ -89,7 +89,7 @@ TEST_F(TestMockManagedLockGetLockerRequest, SuccessExclusive) { InSequence seq; expect_get_lock_info(mock_image_ctx, 0, entity_name_t::CLIENT(1), "1.2.3.4", - "auto 123", ManagedLock<>::WATCHER_LOCK_TAG, + "auto 123", util::get_watcher_lock_tag(), LOCK_EXCLUSIVE); C_SaferCond ctx; @@ -116,7 +116,7 @@ TEST_F(TestMockManagedLockGetLockerRequest, SuccessShared) { InSequence seq; expect_get_lock_info(mock_image_ctx, 0, entity_name_t::CLIENT(1), "1.2.3.4", - "auto 123", ManagedLock<>::WATCHER_LOCK_TAG, + "auto 123", util::get_watcher_lock_tag(), LOCK_SHARED); C_SaferCond ctx; @@ -206,7 +206,7 @@ TEST_F(TestMockManagedLockGetLockerRequest, GetLockInfoIncompatibleShared) { InSequence seq; expect_get_lock_info(mock_image_ctx, 0, entity_name_t::CLIENT(1), "1.2.3.4", - "auto 123", ManagedLock<>::WATCHER_LOCK_TAG, + "auto 123", util::get_watcher_lock_tag(), LOCK_SHARED); C_SaferCond ctx; @@ -228,7 +228,7 @@ TEST_F(TestMockManagedLockGetLockerRequest, GetLockInfoIncompatibleExclusive) { InSequence seq; expect_get_lock_info(mock_image_ctx, 0, entity_name_t::CLIENT(1), "1.2.3.4", - "auto 123", ManagedLock<>::WATCHER_LOCK_TAG, + "auto 123", util::get_watcher_lock_tag(), LOCK_EXCLUSIVE); C_SaferCond ctx; @@ -250,7 +250,7 @@ TEST_F(TestMockManagedLockGetLockerRequest, GetLockInfoExternalCookie) { InSequence seq; expect_get_lock_info(mock_image_ctx, 0, entity_name_t::CLIENT(1), "1.2.3.4", - "external cookie", ManagedLock<>::WATCHER_LOCK_TAG, + "external cookie", util::get_watcher_lock_tag(), LOCK_EXCLUSIVE); C_SaferCond ctx; diff --git a/src/test/librbd/managed_lock/test_mock_ReacquireRequest.cc b/src/test/librbd/managed_lock/test_mock_ReacquireRequest.cc index 103078d2526..76bac7d1474 100644 --- a/src/test/librbd/managed_lock/test_mock_ReacquireRequest.cc +++ b/src/test/librbd/managed_lock/test_mock_ReacquireRequest.cc @@ -16,9 +16,6 @@ #include "librbd/managed_lock/ReacquireRequest.cc" template class librbd::managed_lock::ReacquireRequest; -#include "librbd/ManagedLock.cc" -template class librbd::ManagedLock; - namespace { MATCHER_P(IsLockType, exclusive, "") { @@ -44,7 +41,6 @@ using ::testing::StrEq; class TestMockManagedLockReacquireRequest : public TestMockFixture { public: typedef ReacquireRequest MockReacquireRequest; - typedef ManagedLock MockManagedLock; void expect_set_cookie(MockImageCtx &mock_image_ctx, int r, bool exclusive = true) { diff --git a/src/test/librbd/managed_lock/test_mock_ReleaseRequest.cc b/src/test/librbd/managed_lock/test_mock_ReleaseRequest.cc index 5d94f90ee07..af75f8f2963 100644 --- a/src/test/librbd/managed_lock/test_mock_ReleaseRequest.cc +++ b/src/test/librbd/managed_lock/test_mock_ReleaseRequest.cc @@ -23,9 +23,6 @@ struct Traits { #include "librbd/managed_lock/ReleaseRequest.cc" template class librbd::managed_lock::ReleaseRequest; -#include "librbd/ManagedLock.cc" -template class librbd::ManagedLock; - namespace librbd { namespace managed_lock { @@ -40,7 +37,6 @@ static const std::string TEST_COOKIE("auto 123"); class TestMockManagedLockReleaseRequest : public TestMockFixture { public: typedef ReleaseRequest MockReleaseRequest; - typedef ManagedLock MockManagedLock; void expect_unlock(MockImageCtx &mock_image_ctx, int r) { EXPECT_CALL(get_mock_io_ctx(mock_image_ctx.md_ctx),