[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 <dmonakhov@openvz.org> Cc: Nick Piggin <nickpiggin@yahoo.com.au> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
This commit is contained in:
parent
190a4408ec
commit
d9993c37ef
25
fs/splice.c
25
fs/splice.c
@ -627,18 +627,25 @@ find_page:
|
|||||||
}
|
}
|
||||||
|
|
||||||
ret = mapping->a_ops->commit_write(file, page, offset, offset+this_len);
|
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
|
* Partial write has happened, so 'ret' already initialized by
|
||||||
* accessed, we are now done!
|
* number of bytes written, Where is nothing we have to do here.
|
||||||
*/
|
*/
|
||||||
|
} else
|
||||||
ret = this_len;
|
ret = this_len;
|
||||||
mark_page_accessed(page);
|
/*
|
||||||
balance_dirty_pages_ratelimited(mapping);
|
* Return the number of bytes written and mark page as
|
||||||
} else if (ret == AOP_TRUNCATED_PAGE) {
|
* accessed, we are now done!
|
||||||
page_cache_release(page);
|
*/
|
||||||
goto find_page;
|
mark_page_accessed(page);
|
||||||
}
|
balance_dirty_pages_ratelimited(mapping);
|
||||||
out:
|
out:
|
||||||
page_cache_release(page);
|
page_cache_release(page);
|
||||||
unlock_page(page);
|
unlock_page(page);
|
||||||
|
Loading…
Reference in New Issue
Block a user