FAILED: patch "[PATCH] mm/shmem: don't release a swapin-error marker as a swap entry" failed to apply to 6.18-stable tree
Subsystems (3)
Sasha Levin
maintainerThe patch below does not apply to the 6.18-stable tree.
If someone wants it applied there, or to any other stable or longterm tree, then please email the backport, including the original git commit id to <[email protected]>.
To reproduce the conflict and resubmit, you may use the following commands:
git fetch https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/ linux-6.18.y
git checkout FETCH_HEAD
git cherry-pick -x e4b92891aaca0d37b5973362dd14747a65406650
# <resolve conflicts, build, test, etc.>
git commit -s
git send-email --to '<[email protected]>' --in-reply-to '[email protected]' --subject-prefix 'PATCH 6.18.y' 'HEAD^..'
Thanks,
Sasha
------------------ original commit in Linus's tree ------------------
From e4b92891aaca0d37b5973362dd14747a65406650 Mon Sep 17 00:00:00 2001
From: David Carlier <[email protected]>
Date: Sun, 20 Sep 2026 16:50:02 +0100
Subject: [PATCH] mm/shmem: don't release a swapin-error marker as a swap entry
A failed shmem swapin (eg, EIO) frees the swap slot and leaves a PTE_MARKER_POISONED entry in the page cache. On truncate or eviction shmem_free_swap() passes that marker to swap_put_entries_direct(), which warns because it is not a swap entry. There is nothing left to release either way.
Skip the release for non-swap entries, as every other caller already does.
--- mm/shmem.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
mm/shmem.c +4 -2
@@ -1184,6 +1184,7 @@ static long shmem_free_swap(struct address_space *mapping, pgoff_t index, pgoff_t end, void *radswap) { XA_STATE(xas, &mapping->i_pages, index); +const softleaf_t swp =radix_to_swp_entry (radswap);unsigned int nr_pages =0 ;pgoff_t base;void *entry;
@@ -1200,8 +1201,9 @@ static long shmem_free_swap(struct address_space *mapping, }xas_unlock_irq (&xas); -if (nr_pages) -swap_put_entries_direct (radix_to_swp_entry (radswap), nr_pages); +/* A swapin-error marker holds no swap slot, so just drop it. */ +if (nr_pages &&softleaf_is_swap (swp)) +swap_put_entries_direct (swp, nr_pages);return nr_pages; }
Signature · 1 line
2.53.0
Sasha Levin
maintainerPATCH 1/1 mm/shmem: don't release a swapin-error marker as a swap entry
From: David Carlier <[email protected]>
[ Upstream commit e4b92891aaca0d37b5973362dd14747a65406650 ]
A failed shmem swapin (eg, EIO) frees the swap slot and leaves a PTE_MARKER_POISONED entry in the page cache. On truncate or eviction shmem_free_swap() passes that marker to swap_put_entries_direct(), which warns because it is not a swap entry. There is nothing left to release either way.
Skip the release for non-swap entries, as every other caller already does.
--- mm/shmem.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
mm/shmem.c +4 -2
@@ -947,6 +947,7 @@ static long shmem_free_swap(struct address_space *mapping, pgoff_t index, pgoff_t end, void *radswap) { XA_STATE(xas, &mapping->i_pages, index); +const swp_entry_t swp =radix_to_swp_entry (radswap);unsigned int nr_pages =0 ;pgoff_t base;void *entry;
@@ -963,8 +964,9 @@ static long shmem_free_swap(struct address_space *mapping, }xas_unlock_irq (&xas); -if (nr_pages) -free_swap_and_cache_nr (radix_to_swp_entry (radswap), nr_pages); +/* A swapin-error marker holds no swap slot, so just drop it. */ +if (nr_pages && !non_swap_entry (swp)) +free_swap_and_cache_nr (swp, nr_pages);return nr_pages; }
Signature · 1 line
2.53.0