All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] aio: partial write should not return error code.
@ 2008-01-03  9:04 Rusty Russell
  2008-01-03  9:04 ` [PATCH] aio: negative offset should return -EINVAL Rusty Russell
  2008-01-03 20:04 ` [PATCH] aio: partial write should not return error code Zach Brown
  0 siblings, 2 replies; 6+ messages in thread
From: Rusty Russell @ 2008-01-03  9:04 UTC (permalink / raw)
  To: bcrl; +Cc: linux-aio, Andrew Morton, linux-kernel

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>

diff -r 18802689361a fs/aio.c
--- a/fs/aio.c	Thu Jan 03 15:22:24 2008 +1100
+++ b/fs/aio.c	Thu Jan 03 18:05:25 2008 +1100
@@ -1346,6 +1350,13 @@ static ssize_t aio_rw_vect_retry(struct 
 	/* This means we must have transferred all that we could */
 	/* No need to retry anymore */
 	if ((ret == 0) || (iocb->ki_left == 0))
+		ret = iocb->ki_nbytes - iocb->ki_left;
+
+	/* If we managed to write some out we return that, rather than
+	 * the eventual error. */
+	if (opcode == IOCB_CMD_PWRITEV
+	    && ret < 0
+	    && iocb->ki_nbytes - iocb->ki_left)
 		ret = iocb->ki_nbytes - iocb->ki_left;
 
 	return ret;

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2008-01-04 18:19 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-01-03  9:04 [PATCH] aio: partial write should not return error code Rusty Russell
2008-01-03  9:04 ` [PATCH] aio: negative offset should return -EINVAL Rusty Russell
2008-01-03 20:17   ` Zach Brown
2008-01-03 20:04 ` [PATCH] aio: partial write should not return error code Zach Brown
2008-01-04  3:10   ` Rusty Russell
2008-01-04 18:19     ` Zach Brown

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.