Commit 3172485f authored by Jeff Moyer's avatar Jeff Moyer Committed by Linus Torvalds

block_invalidatepage(): only release page if the full page was invalidated

Prior to commit d47992f8 ("mm: change invalidatepage prototype to
accept length"), an offset of 0 meant that the full page was being
invalidated.  After that commit, we need to instead check the length.

Jan said:
: The only possible issue is that try_to_release_page() was called more
: often than necessary.  Otherwise the issue is harmless but still it's good
: to have this fixed.

Fixes: d47992f8 ("mm: change invalidatepage prototype to accept length")
Signed-off-by: default avatarJeff Moyer <>
Reviewed-by: default avatarJan Kara <>
Cc: Lukas Czerner <>
Cc: Hugh Dickins <>
Signed-off-by: default avatarAndrew Morton <>
Signed-off-by: default avatarLinus Torvalds <>
parent e8b098fc
......@@ -1511,7 +1511,7 @@ void block_invalidatepage(struct page *page, unsigned int offset,
* The get_block cached value has been unconditionally invalidated,
* so real IO is not possible anymore.
if (offset == 0)
if (length == PAGE_SIZE)
try_to_release_page(page, 0);
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment