xfs
[Top] [All Lists]

AIO read returns negative number for bytes read

To: xfs@xxxxxxxxxxx, linux-aio@xxxxxxxxx
Subject: AIO read returns negative number for bytes read
From: Avi Kivity <avi@xxxxxxxxxxxx>
Date: Sun, 15 Nov 2015 15:08:13 +0200
Delivered-to: xfs@xxxxxxxxxxx
Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=scylladb_com.20150623.gappssmtp.com; s=20150623; h=to:from:subject:message-id:date:user-agent:mime-version :content-type; bh=Ai7YHoJDrtDYJ9DjnkcOuLGXhYLTPX/BT/L4XJAfTLE=; b=d7UGSJypmE7Axqeqmyep1f6z0ekhxLxSw0jr8VgEZGg5PFi+r5hOYURQ5oSoXO/0V3 lJu+UUl709UCAFjswJJKxS+++nBAQj63ZIUPVu2/qzG2DQ82DYgtss/7sYEkAEd7Pzhf OpXReR51r1xRsZs5pNYUiXBUPJ/iGBHI8IjhXunzy2GgvoATCL08CEVAy99+2xd8JxOq VPedhjduPz8ziLYXEoTt8VOHktqHpVT4SSPNA7Nf1sHyP39EX/DwLl8viBErE2YGT/xG yUEPsjor3Y/bQh5nteFGTycxVrEJj/un8WD+sNYCiqjASw9UabFik19ftyHCGaxXSdql 28lg==
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.3.0
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?

Attachment: aio_read_fails.c
Description: Text document

<Prev in Thread] Current Thread [Next in Thread>