Thread (3 messages) 3 messages, 2 authors, 2021-11-09

Re: Hitting BUG_ON trap in read_pages() - : [PATCH v2] mm: Optimise put_pages_list()

From: Namjae Jeon <linkinjeon@kernel.org>
Date: 2021-11-09 23:12:47
Also in: linux-fsdevel

2021-11-09 22:34 GMT+09:00, Matthew Wilcox [off-list ref]:
On Tue, Nov 09, 2021 at 07:45:47PM +0900, Namjae Jeon wrote:
quoted
Hi Matthew,

This patch is hitting BUG_ON trap in read_pages() when running
xfstests for cifs.
There seems to be a same issue with other filesystems using .readpages ?
The real fix, of course, is to migrate away from using ->readpages ;-)
I think both 9p and nfs are going away this cycle.  CIFS really needs
to move to using the netfs interfaces.
Okay.
quoted
Could you please take a look ?
Please try this patch:
Work fine.
While free_unref_page_list() puts pages onto the CPU local LRU list, it
does not remove them from the list they were passed in on.  That makes
the list_head appear to be non-empty, and would lead to various corruption
problems if we didn't have an assertion that the list was empty.

Reinitialise the list after calling free_unref_page_list() to avoid
this problem.

Fixes: 988c69f1bc23 ("mm: optimise put_pages_list()")
Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
Tested-by: Namjae Jeon <linkinjeon@kernel.org>

Thanks!
quoted hunk ↗ jump to hunk
diff --git a/mm/swap.c b/mm/swap.c
index 1841c24682f8..e8c9dc6d0377 100644
--- a/mm/swap.c
+++ b/mm/swap.c
@@ -156,6 +156,7 @@ void put_pages_list(struct list_head *pages)
 	}

 	free_unref_page_list(pages);
+	INIT_LIST_HEAD(pages);
 }
 EXPORT_SYMBOL(put_pages_list);
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help