]> git.proxmox.com Git - mirror_ubuntu-jammy-kernel.git/blobdiff - mm/readahead.c
mm: Protect operations adding pages to page cache with invalidate_lock
[mirror_ubuntu-jammy-kernel.git] / mm / readahead.c
index d589f147f4c2f6792d5061ae0fabce35e7efe789..41b75d76d36e1bf07c0f7a0449ebf78761a93227 100644 (file)
@@ -192,6 +192,7 @@ void page_cache_ra_unbounded(struct readahead_control *ractl,
         */
        unsigned int nofs = memalloc_nofs_save();
 
+       filemap_invalidate_lock_shared(mapping);
        /*
         * Preallocate as many pages as we will need.
         */
@@ -236,6 +237,7 @@ void page_cache_ra_unbounded(struct readahead_control *ractl,
         * will then handle the error.
         */
        read_pages(ractl, &page_pool, false);
+       filemap_invalidate_unlock_shared(mapping);
        memalloc_nofs_restore(nofs);
 }
 EXPORT_SYMBOL_GPL(page_cache_ra_unbounded);