summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--mm/huge_memory.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/mm/huge_memory.c b/mm/huge_memory.c
index 032702a4637b..58cabe6af33d 100644
--- a/mm/huge_memory.c
+++ b/mm/huge_memory.c
@@ -4114,6 +4114,18 @@ fail:
remap_page(folio, 1 << old_order, ttu_flags);
/*
+ * Drop the mapping while the inode is still pinned. @folio stays
+ * locked and present in the page cache until the loop below, so
+ * eviction cannot free the inode yet; @lock_at is not enough, it may
+ * be a tail beyond EOF that the split already dropped from the page
+ * cache. Nothing past this point may touch the inode or the mapping.
+ */
+ if (mapping) {
+ i_mmap_unlock_read(mapping);
+ mapping = NULL;
+ }
+
+ /*
* Unlock all after-split folios except the one containing
* @lock_at page. If @folio is not split, it will be kept locked.
*/