summaryrefslogtreecommitdiffstats
path: root/fs
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@woody.linux-foundation.org>2007-03-29 17:23:52 +0200
committerLinus Torvalds <torvalds@woody.linux-foundation.org>2007-03-29 17:23:52 +0200
commit22c8c65d24b37cef1d28583c7a7ffbf84f840e7a (patch)
tree79068b978996727014f4cfe59b26ae19451ec3c2 /fs
parent[PATCH] mm: fix xip issue with /dev/zero (diff)
parent[PATCH] splice: partial write fix (diff)
downloadlinux-22c8c65d24b37cef1d28583c7a7ffbf84f840e7a.tar.xz
linux-22c8c65d24b37cef1d28583c7a7ffbf84f840e7a.zip
Merge branch 'for-linus' of git://git.kernel.dk/data/git/linux-2.6-block
* 'for-linus' of git://git.kernel.dk/data/git/linux-2.6-block: [PATCH] splice: partial write fix
Diffstat (limited to 'fs')
-rw-r--r--fs/splice.c25
1 files changed, 16 insertions, 9 deletions
diff --git a/fs/splice.c b/fs/splice.c
index 07f6556add0a..5428b0ff3b6f 100644
--- a/fs/splice.c
+++ b/fs/splice.c
@@ -627,18 +627,25 @@ find_page:
}
ret = mapping->a_ops->commit_write(file, page, offset, offset+this_len);
- if (!ret) {
+ if (ret) {
+ if (ret == AOP_TRUNCATED_PAGE) {
+ page_cache_release(page);
+ goto find_page;
+ }
+ if (ret < 0)
+ goto out;
/*
- * Return the number of bytes written and mark page as
- * accessed, we are now done!
+ * Partial write has happened, so 'ret' already initialized by
+ * number of bytes written, Where is nothing we have to do here.
*/
+ } else
ret = this_len;
- mark_page_accessed(page);
- balance_dirty_pages_ratelimited(mapping);
- } else if (ret == AOP_TRUNCATED_PAGE) {
- page_cache_release(page);
- goto find_page;
- }
+ /*
+ * Return the number of bytes written and mark page as
+ * accessed, we are now done!
+ */
+ mark_page_accessed(page);
+ balance_dirty_pages_ratelimited(mapping);
out:
page_cache_release(page);
unlock_page(page);