mirror of
https://github.com/MariaDB/server.git
synced 2025-01-15 19:42:28 +01:00
MDEV-27900 fixes
* prevent infinite recursion in beyond-EOF reads (when pread returns 0) * reduce code duplication followup ford78173828e
andf4fb6cb3fe
This commit is contained in:
parent
e9e6db9355
commit
f92388fa14
4 changed files with 14 additions and 19 deletions
|
@ -161,8 +161,7 @@ private:
|
|||
}
|
||||
|
||||
io_uring_cqe_seen(&aio->uring_, cqe);
|
||||
if (iocb->m_ret_len != iocb->m_len && !iocb->m_err)
|
||||
finish_synchronous(iocb);
|
||||
finish_synchronous(iocb);
|
||||
|
||||
// If we need to resubmit the IO operation, but the ring is full,
|
||||
// we will follow the same path as for any other error codes.
|
||||
|
|
|
@ -128,8 +128,7 @@ class aio_linux final : public aio
|
|||
{
|
||||
iocb->m_ret_len= event.res;
|
||||
iocb->m_err= 0;
|
||||
if (iocb->m_ret_len != iocb->m_len)
|
||||
finish_synchronous(iocb);
|
||||
finish_synchronous(iocb);
|
||||
}
|
||||
iocb->m_internal_task.m_func= iocb->m_callback;
|
||||
iocb->m_internal_task.m_arg= iocb;
|
||||
|
|
|
@ -173,7 +173,17 @@ public:
|
|||
protected:
|
||||
static void synchronous(aiocb *cb);
|
||||
/** finish a partial read/write callback synchronously */
|
||||
static void finish_synchronous(aiocb *cb);
|
||||
static inline void finish_synchronous(aiocb *cb)
|
||||
{
|
||||
if (!cb->m_err && cb->m_ret_len != cb->m_len)
|
||||
{
|
||||
/* partial read/write */
|
||||
cb->m_buffer= (char *) cb->m_buffer + cb->m_ret_len;
|
||||
cb->m_len-= (unsigned int) cb->m_ret_len;
|
||||
cb->m_offset+= cb->m_ret_len;
|
||||
synchronous(cb);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
class timer
|
||||
|
|
|
@ -85,24 +85,11 @@ void aio::synchronous(aiocb *cb)
|
|||
#endif
|
||||
cb->m_ret_len = ret_len;
|
||||
cb->m_err = err;
|
||||
if (!err && cb->m_ret_len != cb->m_len)
|
||||
if (ret_len)
|
||||
finish_synchronous(cb);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
A partial read/write has occured, continue synchronously.
|
||||
*/
|
||||
void aio::finish_synchronous(aiocb *cb)
|
||||
{
|
||||
assert(cb->m_ret_len != (unsigned int) cb->m_len && !cb->m_err);
|
||||
/* partial read/write */
|
||||
cb->m_buffer= (char *) cb->m_buffer + cb->m_ret_len;
|
||||
cb->m_len-= (unsigned int) cb->m_ret_len;
|
||||
cb->m_offset+= cb->m_ret_len;
|
||||
synchronous(cb);
|
||||
}
|
||||
|
||||
/**
|
||||
Implementation of generic threadpool.
|
||||
This threadpool consists of the following components
|
||||
|
|
Loading…
Reference in a new issue