From 4c057b34dfc2554ce506f806e126db22e38488d6 Mon Sep 17 00:00:00 2001 From: Jens Axboe Date: Wed, 6 Nov 2013 14:47:22 -0700 Subject: [PATCH 1/1] posixaio: fix thread problem with using errno If we fail queueing a read or a write, use aio_error() to retrieve the right error value. This fixes an issue on (at least) Solaris where we get EAGAIN due to system shortage of resources, but treat that as a random type of error due to using errno. Signed-off-by: Jens Axboe --- engines/posixaio.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/engines/posixaio.c b/engines/posixaio.c index a2b53873..2df26af3 100644 --- a/engines/posixaio.c +++ b/engines/posixaio.c @@ -196,18 +196,20 @@ static int fio_posixaio_queue(struct thread_data *td, return FIO_Q_COMPLETED; #endif } - + if (ret) { + int aio_err = aio_error(aiocb); + /* * At least OSX has a very low limit on the number of pending * IOs, so if it returns EAGAIN, we are out of resources * to queue more. Just return FIO_Q_BUSY to naturally * drop off at this depth. */ - if (errno == EAGAIN) + if (aio_err == EAGAIN) return FIO_Q_BUSY; - io_u->error = errno; + io_u->error = aio_err; td_verror(td, io_u->error, "xfer"); return FIO_Q_COMPLETED; } -- 2.25.1