From: Jeff Layton Date: Fri, 13 May 2022 14:23:25 +0000 (-0400) Subject: [DO NOT MERGE] mm: BUG if filemap_alloc_folio gives us a folio with a non-NULL -... X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=441c773f23ee6274f33eb270c7a9d9e5ceb3940c;p=ceph-client.git [DO NOT MERGE] mm: BUG if filemap_alloc_folio gives us a folio with a non-NULL ->private 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 --- diff --git a/mm/filemap.c b/mm/filemap.c index 7b90cbeb4a1a..dd1876f66673 100644 --- a/mm/filemap.c +++ b/mm/filemap.c @@ -1001,10 +1001,12 @@ struct folio *filemap_alloc_folio_noprof(gfp_t gfp, unsigned int order) n = cpuset_mem_spread_node(); folio = __folio_alloc_node_noprof(gfp, order, n); } while (!folio && read_mems_allowed_retry(cpuset_mems_cookie)); - - return folio; + } else { + folio = folio_alloc_noprof(gfp, order); } - return folio_alloc_noprof(gfp, order); + if (folio) + VM_BUG_ON_FOLIO(folio->private, folio); + return folio; } EXPORT_SYMBOL(filemap_alloc_folio_noprof); #endif