From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mx1.redhat.com ([209.132.183.28]:47088 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1757850AbbKSPdE (ORCPT ); Thu, 19 Nov 2015 10:33:04 -0500 From: Jeff Moyer To: Jan Kara Cc: Avi Kivity , xfs@oss.sgi.com, linux-aio@kvack.org, Steven Whitehouse , linux-fsdevel@vger.kernel.org Subject: Re: AIO read returns negative number for bytes read References: <564883BD.8070607@scylladb.com> <564B2303.7000902@scylladb.com> <20151119153004.GB25804@quack.suse.cz> Date: Thu, 19 Nov 2015 10:33:03 -0500 In-Reply-To: <20151119153004.GB25804@quack.suse.cz> (Jan Kara's message of "Thu, 19 Nov 2015 16:30:04 +0100") Message-ID: MIME-Version: 1.0 Content-Type: text/plain Sender: linux-fsdevel-owner@vger.kernel.org List-ID: Jan Kara writes: > Can you please post the reproduce here as well? I couldn't easily find it > with google. Here it is, Jan. -Jeff #define _GNU_SOURCE #include #include #include #include #include #include #include #include int main(int ac, char** av) { int fd; char* buf; io_context_t ioc = NULL; int r; struct iocb iocb; struct iocb *iocbp[1]; struct io_event ioev; buf = aligned_alloc(4096, 4096*4); assert(buf); r = io_setup(1, &ioc); assert(r == 0); fd = open("tmp.tmp", O_RDWR | O_CREAT | O_DIRECT, 0600); assert(fd >= 0); io_prep_pwrite(&iocb, fd, buf, 4096*4, 0); iocbp[0] = &iocb; r = io_submit(ioc, 1, iocbp); assert(r == 1); r = io_getevents(ioc, 1, 1, &ioev, NULL); assert(r == 1); assert(ioev.res == 4*4096); ftruncate(fd, 13002); io_prep_pread(&iocb, fd, buf, 8192, 13312); r = io_submit(ioc, 1, iocbp); assert(r == 1); r = io_getevents(ioc, 1, 1, &ioev, NULL); assert(r == 1); printf("read result: %d\n", (int)ioev.res); return 0; }