diff options
| author | Jens Axboe <[email protected]> | 2025-05-27 13:28:53 +0000 |
|---|---|---|
| committer | Christian Brauner <[email protected]> | 2025-05-27 19:06:24 +0000 |
| commit | 25b065a744ff0c1099bb357be1c40030b5a14c07 (patch) | |
| tree | b987f42d174841aff05e59fa08fa82e599a19c83 /mm/filemap.c | |
| parent | mm/filemap: gate dropbehind invalidate on folio !dirty && !writeback (diff) | |
| download | kernel-25b065a744ff0c1099bb357be1c40030b5a14c07.tar.gz kernel-25b065a744ff0c1099bb357be1c40030b5a14c07.zip | |
mm/filemap: use filemap_end_dropbehind() for read invalidation
Use the filemap_end_dropbehind() helper rather than calling
folio_unmap_invalidate() directly, as we need to check if the folio has
been redirtied or marked for writeback once the folio lock has been
re-acquired.
Cc: [email protected]
Reported-by: Trond Myklebust <[email protected]>
Fixes: 8026e49bff9b ("mm/filemap: add read support for RWF_DONTCACHE")
Link: https://lore.kernel.org/linux-fsdevel/[email protected]/
Signed-off-by: Jens Axboe <[email protected]>
Link: https://lore.kernel.org/[email protected]
Signed-off-by: Christian Brauner <[email protected]>
Diffstat (limited to 'mm/filemap.c')
| -rw-r--r-- | mm/filemap.c | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/mm/filemap.c b/mm/filemap.c index 008a55290f34..6af6d8f2929c 100644 --- a/mm/filemap.c +++ b/mm/filemap.c @@ -2644,8 +2644,7 @@ static inline bool pos_same_folio(loff_t pos1, loff_t pos2, struct folio *folio) return (pos1 >> shift == pos2 >> shift); } -static void filemap_end_dropbehind_read(struct address_space *mapping, - struct folio *folio) +static void filemap_end_dropbehind_read(struct folio *folio) { if (!folio_test_dropbehind(folio)) return; @@ -2653,7 +2652,7 @@ static void filemap_end_dropbehind_read(struct address_space *mapping, return; if (folio_trylock(folio)) { if (folio_test_clear_dropbehind(folio)) - folio_unmap_invalidate(mapping, folio, 0); + filemap_end_dropbehind(folio); folio_unlock(folio); } } @@ -2774,7 +2773,7 @@ put_folios: for (i = 0; i < folio_batch_count(&fbatch); i++) { struct folio *folio = fbatch.folios[i]; - filemap_end_dropbehind_read(mapping, folio); + filemap_end_dropbehind_read(folio); folio_put(folio); } folio_batch_init(&fbatch); |
