From: Jason Dillaman Date: Tue, 21 Jul 2015 17:32:44 +0000 (-0400) Subject: librados_test_stub: assert that no AIO ops are outstanding on destruction X-Git-Tag: v10.0.1~102^2~8 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=2d7f4d04866613ac79dfd7609cb2f2c5b3e25474;p=ceph.git librados_test_stub: assert that no AIO ops are outstanding on destruction Signed-off-by: Jason Dillaman --- diff --git a/src/test/librados_test_stub/TestIoCtxImpl.cc b/src/test/librados_test_stub/TestIoCtxImpl.cc index ebb5d745232c..4bde5c94200a 100644 --- a/src/test/librados_test_stub/TestIoCtxImpl.cc +++ b/src/test/librados_test_stub/TestIoCtxImpl.cc @@ -38,6 +38,7 @@ TestIoCtxImpl::TestIoCtxImpl(const TestIoCtxImpl& rhs) } TestIoCtxImpl::~TestIoCtxImpl() { + assert(m_pending_ops.read() == 0); } void TestObjectOperationImpl::get() { @@ -104,6 +105,7 @@ int TestIoCtxImpl::aio_operate(const std::string& oid, TestObjectOperationImpl & int flags) { // TODO flags for now ops.get(); + m_pending_ops.inc(); m_client->add_aio_operation(oid, true, boost::bind( &TestIoCtxImpl::execute_aio_operations, this, oid, &ops, reinterpret_cast(0), @@ -117,6 +119,7 @@ int TestIoCtxImpl::aio_operate_read(const std::string& oid, bufferlist *pbl) { // TODO ignoring flags for now ops.get(); + m_pending_ops.inc(); m_client->add_aio_operation(oid, true, boost::bind( &TestIoCtxImpl::execute_aio_operations, this, oid, &ops, pbl, m_snapc), c); return 0; @@ -155,6 +158,7 @@ int TestIoCtxImpl::operate(const std::string& oid, TestObjectOperationImpl &ops) AioCompletionImpl *comp = new AioCompletionImpl(); ops.get(); + m_pending_ops.inc(); m_client->add_aio_operation(oid, false, boost::bind( &TestIoCtxImpl::execute_aio_operations, this, oid, &ops, reinterpret_cast(0), m_snapc), comp); @@ -170,6 +174,7 @@ int TestIoCtxImpl::operate_read(const std::string& oid, TestObjectOperationImpl AioCompletionImpl *comp = new AioCompletionImpl(); ops.get(); + m_pending_ops.inc(); m_client->add_aio_operation(oid, false, boost::bind( &TestIoCtxImpl::execute_aio_operations, this, oid, &ops, pbl, m_snapc), comp); @@ -279,6 +284,7 @@ int TestIoCtxImpl::execute_aio_operations(const std::string& oid, break; } } + m_pending_ops.dec(); ops->put(); return ret; } diff --git a/src/test/librados_test_stub/TestIoCtxImpl.h b/src/test/librados_test_stub/TestIoCtxImpl.h index 37094adcc0f6..c38e90edb7e5 100644 --- a/src/test/librados_test_stub/TestIoCtxImpl.h +++ b/src/test/librados_test_stub/TestIoCtxImpl.h @@ -172,6 +172,7 @@ private: snap_t m_snap_seq; SnapContext m_snapc; atomic_t m_refcount; + atomic_t m_pending_ops; void handle_aio_notify_complete(AioCompletionImpl *aio_comp, int r); };