summaryrefslogtreecommitdiff
path: root/mm/truncate.c
diff options
context:
space:
mode:
Diffstat (limited to 'mm/truncate.c')
-rw-r--r--mm/truncate.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/mm/truncate.c b/mm/truncate.c
index b73c30c95cd0..06b7a4ca2370 100644
--- a/mm/truncate.c
+++ b/mm/truncate.c
@@ -287,7 +287,9 @@ int invalidate_inode_page(struct page *page)
return 0;
if (folio_test_dirty(folio) || folio_test_writeback(folio))
return 0;
- if (page_mapped(page))
+ /* The refcount will be elevated if any page in the folio is mapped */
+ if (folio_ref_count(folio) >
+ folio_nr_pages(folio) + folio_has_private(folio) + 1)
return 0;
if (folio_has_private(folio) && !filemap_release_folio(folio, 0))
return 0;