1. 23 Jun, 2022 2 commits
    • Alistair Popple's avatar
      filemap: Fix serialization adding transparent huge pages to page cache · 00fa15e0
      Alistair Popple authored
      Commit 793917d9 ("mm/readahead: Add large folio readahead")
      introduced support for using large folios for filebacked pages if the
      filesystem supports it.
      
      page_cache_ra_order() was introduced to allocate and add these large
      folios to the page cache. However adding pages to the page cache should
      be serialized against truncation and hole punching by taking
      invalidate_lock. Not doing so can lead to data races resulting in stale
      data getting added to the page cache and marked up-to-date. See commit
      730633f0 ("mm: Protect operations adding pages to page cache with
      invalidate_lock") for more details.
      
      This issue was found by inspection but a testcase revealed it was
      possible to observe in practice on XFS. Fix this by taking
      invalidate_lock in page_cache_ra_order(), to mirror what is done for the
      non-thp case in page_cache_ra_unbounded().
      Signed-off-by: default avatarAlistair Popple <apopple@nvidia.com>
      Fixes: 793917d9 ("mm/readahead: Add large folio readahead")
      Reviewed-by: default avatarJan Kara <jack@suse.cz>
      Signed-off-by: default avatarMatthew Wilcox (Oracle) <willy@infradead.org>
      00fa15e0
    • Matthew Wilcox (Oracle)'s avatar
      mm: Clear page->private when splitting or migrating a page · b653db77
      Matthew Wilcox (Oracle) authored
      In our efforts to remove uses of PG_private, we have found folios with
      the private flag clear and folio->private not-NULL.  That is the root
      cause behind 642d51fb ("ceph: check folio PG_private bit instead
      of folio->private").  It can also affect a few other filesystems that
      haven't yet reported a problem.
      
      compaction_alloc() can return a page with uninitialised page->private,
      and rather than checking all the callers of migrate_pages(), just zero
      page->private after calling get_new_page().  Similarly, the tail pages
      from split_huge_page() may also have an uninitialised page->private.
      Reported-by: default avatarXiubo Li <xiubli@redhat.com>
      Tested-by: default avatarXiubo Li <xiubli@redhat.com>
      Signed-off-by: default avatarMatthew Wilcox (Oracle) <willy@infradead.org>
      b653db77
  2. 20 Jun, 2022 6 commits
  3. 19 Jun, 2022 24 commits
  4. 18 Jun, 2022 8 commits