From: Rusty Russell <rusty@rustcorp.com.au>
To: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Andrew Morton <akpm@linux-foundation.org>,
linux-kernel@vger.kernel.org, Zach Brown <zach.brown@oracle.com>,
bcrl@kvack.org, linux-aio@kvack.org
Subject: [PATCH] aio_write should tell userspace about partial writes
Date: Wed, 12 Mar 2008 09:39:59 +1100 [thread overview]
Message-ID: <200803120939.59915.rusty@rustcorp.com.au> (raw)
[ 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@rustcorp.com.au>
Acked-By: Zach Brown <zach.brown@oracle.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;
}
next reply other threads:[~2008-03-11 22:41 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-03-11 22:39 Rusty Russell [this message]
2008-03-12 19:59 ` [PATCH] aio_write should tell userspace about partial writes Linus Torvalds
2008-03-12 22:12 ` Rusty Russell
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=200803120939.59915.rusty@rustcorp.com.au \
--to=rusty@rustcorp.com.au \
--cc=akpm@linux-foundation.org \
--cc=bcrl@kvack.org \
--cc=linux-aio@kvack.org \
--cc=linux-kernel@vger.kernel.org \
--cc=torvalds@linux-foundation.org \
--cc=zach.brown@oracle.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox