aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRusty Russell <rusty@rustcorp.com.au>2008-02-08 07:20:14 -0500
committerLinus Torvalds <torvalds@woody.linux-foundation.org>2008-02-08 12:22:33 -0500
commit7adfa2ff3efa02a7a9f2632d2d2662d3e5eb5304 (patch)
tree8a312d527e25142c65eec3bf9360cfbaae4c2666
parent25478445c4a39318acbe08ba8df7945766cbb5b5 (diff)
aio: partial write should not return error code
When an AIO write gets an error after writing some data (eg. ENOSPC), it should return the amount written already, not the error. Just like write() is supposed to. This was found by the libaio test suite. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au> Acked-By: Zach Brown <zach.brown@oracle.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
-rw-r--r--fs/aio.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/fs/aio.c b/fs/aio.c
index 8a48ab0c278d..26c1930889fa 100644
--- a/fs/aio.c
+++ b/fs/aio.c
@@ -1347,6 +1347,13 @@ static ssize_t aio_rw_vect_retry(struct kiocb *iocb)
1347 if ((ret == 0) || (iocb->ki_left == 0)) 1347 if ((ret == 0) || (iocb->ki_left == 0))
1348 ret = iocb->ki_nbytes - iocb->ki_left; 1348 ret = iocb->ki_nbytes - iocb->ki_left;
1349 1349
1350 /* If we managed to write some out we return that, rather than
1351 * the eventual error. */
1352 if (opcode == IOCB_CMD_PWRITEV
1353 && ret < 0 && ret != -EIOCBQUEUED && ret != -EIOCBRETRY
1354 && iocb->ki_nbytes - iocb->ki_left)
1355 ret = iocb->ki_nbytes - iocb->ki_left;
1356
1350 return ret; 1357 return ret;
1351} 1358}
1352 1359