diff options
| author | Linus Torvalds <torvalds@woody.linux-foundation.org> | 2007-03-29 11:23:52 -0400 |
|---|---|---|
| committer | Linus Torvalds <torvalds@woody.linux-foundation.org> | 2007-03-29 11:23:52 -0400 |
| commit | 22c8c65d24b37cef1d28583c7a7ffbf84f840e7a (patch) | |
| tree | 79068b978996727014f4cfe59b26ae19451ec3c2 | |
| parent | a76c0b976310bbb1b6eaecaaae465af194134477 (diff) | |
| parent | d9993c37ef87c758d4a6e63972395b1cf8a4cb7b (diff) | |
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
| -rw-r--r-- | fs/splice.c | 25 |
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: | |||
| 627 | } | 627 | } |
| 628 | 628 | ||
| 629 | ret = mapping->a_ops->commit_write(file, page, offset, offset+this_len); | 629 | ret = mapping->a_ops->commit_write(file, page, offset, offset+this_len); |
| 630 | if (!ret) { | 630 | if (ret) { |
| 631 | if (ret == AOP_TRUNCATED_PAGE) { | ||
| 632 | page_cache_release(page); | ||
| 633 | goto find_page; | ||
| 634 | } | ||
| 635 | if (ret < 0) | ||
| 636 | goto out; | ||
| 631 | /* | 637 | /* |
| 632 | * Return the number of bytes written and mark page as | 638 | * Partial write has happened, so 'ret' already initialized by |
| 633 | * accessed, we are now done! | 639 | * number of bytes written, Where is nothing we have to do here. |
| 634 | */ | 640 | */ |
| 641 | } else | ||
| 635 | ret = this_len; | 642 | ret = this_len; |
| 636 | mark_page_accessed(page); | 643 | /* |
| 637 | balance_dirty_pages_ratelimited(mapping); | 644 | * Return the number of bytes written and mark page as |
| 638 | } else if (ret == AOP_TRUNCATED_PAGE) { | 645 | * accessed, we are now done! |
| 639 | page_cache_release(page); | 646 | */ |
| 640 | goto find_page; | 647 | mark_page_accessed(page); |
| 641 | } | 648 | balance_dirty_pages_ratelimited(mapping); |
| 642 | out: | 649 | out: |
| 643 | page_cache_release(page); | 650 | page_cache_release(page); |
| 644 | unlock_page(page); | 651 | unlock_page(page); |
