Gitweb:     
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=d9993c37ef87c758d4a6e63972395b1cf8a4cb7b
Commit:     d9993c37ef87c758d4a6e63972395b1cf8a4cb7b
Parent:     190a4408ecb577391ea5fbd1f90148a6992a5756
Author:     Dmitriy Monakhov <[EMAIL PROTECTED]>
AuthorDate: Thu Mar 29 14:24:09 2007 +0200
Committer:  Jens Axboe <[EMAIL PROTECTED]>
CommitDate: Thu Mar 29 14:26:42 2007 +0200

    [PATCH] splice: partial write fix
    
    Currently if partial write has happened while ->commit_write() then page
    wasn't marked as accessed and rebalanced.
    
    Signed-off-by: Monakhov Dmitriy <[EMAIL PROTECTED]>
    Cc: Nick Piggin <[EMAIL PROTECTED]>
    Signed-off-by: Andrew Morton <[EMAIL PROTECTED]>
    Signed-off-by: Jens Axboe <[EMAIL PROTECTED]>
---
 fs/splice.c |   25 ++++++++++++++++---------
 1 files changed, 16 insertions(+), 9 deletions(-)

diff --git a/fs/splice.c b/fs/splice.c
index 07f6556..5428b0f 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);
-
To unsubscribe from this list: send the line "unsubscribe git-commits-head" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to