Return-Path: Received: from mx3-rdu2.redhat.com ([66.187.233.73]:53246 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751881AbeBWVGQ (ORCPT ); Fri, 23 Feb 2018 16:06:16 -0500 From: Jeff Moyer To: linux-fsdevel@vger.kernel.org Cc: lczerner@redhat.com, Andrew Morton , Hugh Dickins Subject: [patch] block_invalidatepage: only release page if the full page was invalidated Date: Fri, 23 Feb 2018 16:06:15 -0500 Message-ID: MIME-Version: 1.0 Content-Type: text/plain Sender: linux-fsdevel-owner@vger.kernel.org List-ID: Prior to commit d47992f86b307 ("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. Fixes: d47992f86b307 ("mm: change invalidatepage prototype to accept length") Signed-off-by: Jeff Moyer --- Note that I found this via code inspection. I'm not sure if this causes issues in the wild. diff --git a/fs/buffer.c b/fs/buffer.c index 9a73924db22f..6b98609356ed 100644 --- a/fs/buffer.c +++ b/fs/buffer.c @@ -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); out: return;