Skip to content

Commit a1bba0e

Browse files
committed
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.
1 parent 8761047 commit a1bba0e

File tree

1 file changed

+10
-6
lines changed

1 file changed

+10
-6
lines changed

tpool/aio_liburing.cc

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -29,11 +29,12 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111 - 1301 USA*/
2929

3030
namespace
3131
{
32+
using namespace tpool;
3233

33-
class aio_uring final : public tpool::aio
34+
class aio_uring final : public aio
3435
{
3536
public:
36-
aio_uring(tpool::thread_pool *tpool, int max_aio) : tpool_(tpool)
37+
aio_uring(thread_pool *tpool, int max_aio) : tpool_(tpool)
3738
{
3839
if (const auto e= io_uring_queue_init(max_aio, &uring_, 0))
3940
{
@@ -71,6 +72,9 @@ class aio_uring final : public tpool::aio
7172
}
7273
throw std::runtime_error("aio_uring()");
7374
}
75+
#if __has_feature(memory_sanitizer)
76+
MEM_MAKE_DEFINED(&uring_, sizeof(uring_));
77+
#endif
7478
if (io_uring_ring_dontfork(&uring_) != 0)
7579
{
7680
my_printf_error(ER_UNKNOWN_ERROR,
@@ -102,7 +106,7 @@ class aio_uring final : public tpool::aio
102106
io_uring_queue_exit(&uring_);
103107
}
104108

105-
int submit_io(tpool::aiocb *cb) final
109+
int submit_io(aiocb *cb) final
106110
{
107111
cb->iov_base= cb->m_buffer;
108112
cb->iov_len= cb->m_len;
@@ -112,7 +116,7 @@ class aio_uring final : public tpool::aio
112116
std::lock_guard<std::mutex> _(mutex_);
113117

114118
io_uring_sqe *sqe= io_uring_get_sqe(&uring_);
115-
if (cb->m_opcode == tpool::aio_opcode::AIO_PREAD)
119+
if (cb->m_opcode == aio_opcode::AIO_PREAD)
116120
io_uring_prep_readv(sqe, cb->m_fh, static_cast<struct iovec *>(cb), 1,
117121
cb->m_offset);
118122
else
@@ -159,7 +163,7 @@ class aio_uring final : public tpool::aio
159163
abort();
160164
}
161165

162-
auto *iocb= static_cast<tpool::aiocb*>(io_uring_cqe_get_data(cqe));
166+
auto *iocb= static_cast<aiocb*>(io_uring_cqe_get_data(cqe));
163167
if (!iocb)
164168
break; // ~aio_uring() told us to terminate
165169

@@ -196,7 +200,7 @@ class aio_uring final : public tpool::aio
196200

197201
io_uring uring_;
198202
std::mutex mutex_;
199-
tpool::thread_pool *tpool_;
203+
thread_pool *tpool_;
200204
std::thread thread_;
201205

202206
std::vector<native_file_handle> files_;

0 commit comments

Comments
 (0)