]> git.kernelconcepts.de Git - karo-tx-linux.git/blobdiff - mm/truncate.c
Merge tag 'pm-fixes-4.13-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael...
[karo-tx-linux.git] / mm / truncate.c
index 6479ed2afc53fb9dd8d9719051ea77e7a5b200af..2330223841fbbdf40c4e50764a11a557d9c7b426 100644 (file)
@@ -530,9 +530,15 @@ unsigned long invalidate_mapping_pages(struct address_space *mapping,
                        } else if (PageTransHuge(page)) {
                                index += HPAGE_PMD_NR - 1;
                                i += HPAGE_PMD_NR - 1;
-                               /* 'end' is in the middle of THP */
-                               if (index ==  round_down(end, HPAGE_PMD_NR))
+                               /*
+                                * 'end' is in the middle of THP. Don't
+                                * invalidate the page as the part outside of
+                                * 'end' could be still useful.
+                                */
+                               if (index > end) {
+                                       unlock_page(page);
                                        continue;
+                               }
                        }
 
                        ret = invalidate_inode_page(page);