[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <200803120939.59915.rusty@rustcorp.com.au>
Date: Wed, 12 Mar 2008 09:39:59 +1100
From: Rusty Russell <rusty@...tcorp.com.au>
To: Linus Torvalds <torvalds@...ux-foundation.org>
Cc: Andrew Morton <akpm@...ux-foundation.org>,
linux-kernel@...r.kernel.org, Zach Brown <zach.brown@...cle.com>,
bcrl@...ck.org, linux-aio@...ck.org
Subject: [PATCH] aio_write should tell userspace about partial writes
[ Linus, please apply. This patch was discussed and acked before,
but somehow got lost. ]
When an AIO write gets a non-retry 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@...tcorp.com.au>
Acked-By: Zach Brown <zach.brown@...cle.com>
---
fs/aio.c | 7 +++++++
1 file changed, 7 insertions(+)
diff -r c36fc295bb75 fs/aio.c
--- a/fs/aio.c Tue Mar 11 09:04:47 2008 +1100
+++ b/fs/aio.c Tue Mar 11 09:05:54 2008 +1100
@@ -1358,6 +1358,13 @@ static ssize_t aio_rw_vect_retry(struct
&& iocb->ki_nbytes - iocb->ki_left)
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 && ret != -EIOCBQUEUED && ret != -EIOCBRETRY
+ && iocb->ki_nbytes - iocb->ki_left)
+ ret = iocb->ki_nbytes - iocb->ki_left;
+
return ret;
}
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists