From e4493d37e76ec97b056e5b80b61533bfd3def749 Mon Sep 17 00:00:00 2001 From: Jeff Layton Date: Fri, 13 May 2022 10:23:25 -0400 Subject: [PATCH] UBUNTU: SAUCE: mm: BUG if filemap_alloc_folio gives us a folio with a non-NULL ->private MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit BugLink: https://bugs.launchpad.net/bugs/2032959 We've seen some instances where we call __filemap_get_folio and get back one with a ->private value that is non-NULL. Let's have the allocator bug if that happens. For now, let's just put this into the testing kernel. We can let Willy decide if he wants it in mainline. URL: https://tracker.ceph.com/issues/55421 Cc: Matthew Wilcox Cc: Xiubo Li Cc: Luís Henriques Signed-off-by: Jeff Layton (cherry picked from https://github.com/ceph/ceph-client.git) Signed-off-by: Andrea Righi --- mm/filemap.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/mm/filemap.c b/mm/filemap.c index 4a30de98a8c7..09e023c0a27e 100644 --- a/mm/filemap.c +++ b/mm/filemap.c @@ -969,10 +969,12 @@ struct folio *filemap_alloc_folio(gfp_t gfp, unsigned int order) n = cpuset_mem_spread_node(); folio = __folio_alloc_node(gfp, order, n); } while (!folio && read_mems_allowed_retry(cpuset_mems_cookie)); - - return folio; + } else { + folio = folio_alloc(gfp, order); } - return folio_alloc(gfp, order); + if (folio) + VM_BUG_ON_FOLIO(folio->private, folio); + return folio; } EXPORT_SYMBOL(filemap_alloc_folio); #endif