From a1bba0e31cf33f822cfb0c95eda24310d9833a80 Mon Sep 17 00:00:00 2001 From: Daniel Black Date: Mon, 25 Aug 2025 13:01:06 +1000 Subject: [PATCH] MDEV-36482: Make liburing work WITH_MSAN=ON (fix) The uring_ member of the aio_uring class needed to be defined to make MSAN happy. To make aio_uring consistent with aio_libaio in the 10.11 branch, added the "using namespace tpool" and removed tpool scoped quantifiers. 10.6 aio_uring is defined in the tpool namespace however changing that would just cause merge conflicts. --- tpool/aio_liburing.cc | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/tpool/aio_liburing.cc b/tpool/aio_liburing.cc index 447efa8f4932c..9fef1bd3432e1 100644 --- a/tpool/aio_liburing.cc +++ b/tpool/aio_liburing.cc @@ -29,11 +29,12 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111 - 1301 USA*/ namespace { +using namespace tpool; -class aio_uring final : public tpool::aio +class aio_uring final : public aio { public: - aio_uring(tpool::thread_pool *tpool, int max_aio) : tpool_(tpool) + aio_uring(thread_pool *tpool, int max_aio) : tpool_(tpool) { if (const auto e= io_uring_queue_init(max_aio, &uring_, 0)) { @@ -71,6 +72,9 @@ class aio_uring final : public tpool::aio } throw std::runtime_error("aio_uring()"); } +#if __has_feature(memory_sanitizer) + MEM_MAKE_DEFINED(&uring_, sizeof(uring_)); +#endif if (io_uring_ring_dontfork(&uring_) != 0) { my_printf_error(ER_UNKNOWN_ERROR, @@ -102,7 +106,7 @@ class aio_uring final : public tpool::aio io_uring_queue_exit(&uring_); } - int submit_io(tpool::aiocb *cb) final + int submit_io(aiocb *cb) final { cb->iov_base= cb->m_buffer; cb->iov_len= cb->m_len; @@ -112,7 +116,7 @@ class aio_uring final : public tpool::aio std::lock_guard _(mutex_); io_uring_sqe *sqe= io_uring_get_sqe(&uring_); - if (cb->m_opcode == tpool::aio_opcode::AIO_PREAD) + if (cb->m_opcode == aio_opcode::AIO_PREAD) io_uring_prep_readv(sqe, cb->m_fh, static_cast(cb), 1, cb->m_offset); else @@ -159,7 +163,7 @@ class aio_uring final : public tpool::aio abort(); } - auto *iocb= static_cast(io_uring_cqe_get_data(cqe)); + auto *iocb= static_cast(io_uring_cqe_get_data(cqe)); if (!iocb) break; // ~aio_uring() told us to terminate @@ -196,7 +200,7 @@ class aio_uring final : public tpool::aio io_uring uring_; std::mutex mutex_; - tpool::thread_pool *tpool_; + thread_pool *tpool_; std::thread thread_; std::vector files_;