AIO read returns negative number for bytes read

Avi Kivity avi at scylladb.com
Mon Nov 16 09:32:53 CST 2015



On 11/16/2015 05:19 PM, Alireza Haghdoost wrote:
> On Sun, Nov 15, 2015 at 7:08 AM, Avi Kivity <avi at scylladb.com> wrote:
>> Due to a bug in my program, I initiated a read beyond eof. Specifically, the
>> file size is 13002 bytes and the read offset is 13312 (0x3400).
>>
>> I would expect such a read to return 0 bytes read, but io_getevents returns
>> -310, which is suspiciously equal to (13002 - 13312).
>>
>> I attach a reproducer.
>>
>> 4.2.5-201.fc22.x86_64
>>
>> Are my expectations incorrect, or is this a bug in aio or xfs?
> I think it is not a bug. This post might be helpful:
> http://marc.info/?l=linux-aio&m=142315449930935&w=2

The post indicates that it is a bug.  A negative value indicates an 
error, but there is no error 310.



More information about the xfs mailing list