|
@@ -1399,7 +1399,15 @@ static void collapse_shmem(struct mm_struct *mm,
|
|
|
*/
|
|
|
VM_BUG_ON_PAGE(!PageLocked(page), page);
|
|
|
VM_BUG_ON_PAGE(!PageUptodate(page), page);
|
|
|
- VM_BUG_ON_PAGE(PageTransCompound(page), page);
|
|
|
+
|
|
|
+ /*
|
|
|
+ * If file was truncated then extended, or hole-punched, before
|
|
|
+ * we locked the first page, then a THP might be there already.
|
|
|
+ */
|
|
|
+ if (PageTransCompound(page)) {
|
|
|
+ result = SCAN_PAGE_COMPOUND;
|
|
|
+ goto out_unlock;
|
|
|
+ }
|
|
|
|
|
|
if (page_mapping(page) != mapping) {
|
|
|
result = SCAN_TRUNCATED;
|