diff --git a/mm/vmscan.c b/mm/vmscan.c
index 5bde0740930335319afed277d16c52b2325403eb..d257916f39e50027dc7c06aa38c19430ee9dc4ee 100644
--- a/mm/vmscan.c
+++ b/mm/vmscan.c
@@ -1967,6 +1967,16 @@ static unsigned int shrink_folio_list(struct list_head *folio_list,
 			}
 		}
 
+		/*
+		 * Folio is unmapped now so it cannot be newly pinned anymore.
+		 * No point in trying to reclaim folio if it is pinned.
+		 * Furthermore we don't want to reclaim underlying fs metadata
+		 * if the folio is pinned and thus potentially modified by the
+		 * pinning process as that may upset the filesystem.
+		 */
+		if (folio_maybe_dma_pinned(folio))
+			goto activate_locked;
+
 		mapping = folio_mapping(folio);
 		if (folio_test_dirty(folio)) {
 			/*