Reputation: 237
I have a testing utility that uses linux aio_write and aio_read. This testing utility wraps my static library and test it. This library is multi-threaded black box.
Up until now, it worked fine. But now we made a big change into the this black-box which causes the testing utility to fail as soon as it commits the first IO. This IO returns with errno 22 == EINVAL.
Based on the aio_write man pages, this error is issued in case one of the following fields is invalid --> aio_offset, aio_reqprio, aio_nbytes. I run it inside gdb and tested their values as long as with all other values inside the struct aiocb * input parameter. My conclusion is that the input parameters are all valid.
I suspect something has changed in the way threads are working inside the black-box. This is what i suspect causing this issue (i can not find any other explanation).
What I really try to understand is: Which scenarios causes aio_write() to return a EINVAL error code???
Just to clarify, when I replace the black-box to an older version, using the same testing utility it works fine.... (i also tested the input arguments here as saw they are matching to the bad version input arguments).
Upvotes: 1
Views: 1829
Reputation: 756
You can take a look at the aio implementation in the linux source code at the folder linux-kernel-source/fs/aio.c
Sadly there are a lot of points where -EINVAL is returned. As @myaut mentioned in his comment, I recommend you to use strace
. Another solution would be to modify the code, compile it and check where it fails.
Upvotes: 2