From: Jens Axboe Date: Wed, 6 Nov 2013 21:47:22 +0000 (-0700) Subject: posixaio: fix thread problem with using errno X-Git-Tag: fio-2.1.4~5 X-Git-Url: https://git.kernel.dk/?p=fio.git;a=commitdiff_plain;h=4c057b34dfc2554ce506f806e126db22e38488d6;hp=a7533dbd90c821b2db04aa53168a4d0f4259ea6d 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 --- 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; }