summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--mm/page_io.c1
-rw-r--r--mm/zswap.c12
2 files changed, 12 insertions, 1 deletions
diff --git a/mm/page_io.c b/mm/page_io.c
index 488ecacef84f..6c1c1828bb88 100644
--- a/mm/page_io.c
+++ b/mm/page_io.c
@@ -515,7 +515,6 @@ void swap_read_folio(struct folio *folio, struct swap_iocb **plug)
delayacct_swapin_start();
if (zswap_load(folio)) {
- folio_mark_uptodate(folio);
folio_unlock(folio);
} else if (data_race(sis->flags & SWP_FS_OPS)) {
swap_read_folio_fs(folio, plug);
diff --git a/mm/zswap.c b/mm/zswap.c
index 9d4e54282b5f..a546c01602aa 100644
--- a/mm/zswap.c
+++ b/mm/zswap.c
@@ -1567,6 +1567,17 @@ bool zswap_load(struct folio *folio)
return false;
/*
+ * Large folios should not be swapped in while zswap is being used, as
+ * they are not properly handled. Zswap does not properly load large
+ * folios, and a large folio may only be partially in zswap.
+ *
+ * Return true without marking the folio uptodate so that an IO error is
+ * emitted (e.g. do_swap_page() will sigbus).
+ */
+ if (WARN_ON_ONCE(folio_test_large(folio)))
+ return true;
+
+ /*
* When reading into the swapcache, invalidate our entry. The
* swapcache can be the authoritative owner of the page and
* its mappings, and the pressure that results from having two
@@ -1600,6 +1611,7 @@ bool zswap_load(struct folio *folio)
folio_mark_dirty(folio);
}
+ folio_mark_uptodate(folio);
return true;
}