]> git.apps.os.sepia.ceph.com Git - ceph-client.git/commitdiff
[DO NOT MERGE] mm: BUG if filemap_alloc_folio gives us a folio with a non-NULL -...
authorJeff Layton <jlayton@kernel.org>
Fri, 13 May 2022 14:23:25 +0000 (10:23 -0400)
committerJeff Layton <jlayton@kernel.org>
Tue, 31 May 2022 14:44:35 +0000 (10:44 -0400)
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 <willy@infradead.org>
Cc: Xiubo Li <xiubli@redhat.com>
Cc: Luís Henriques <lhenriques@suse.de>
Signed-off-by: Jeff Layton <jlayton@kernel.org>
mm/filemap.c

index 9a1eef6c5d350e6fadb77be23a48c34818d6310e..74c3fb062ef748f228f07a7be4ad0b47ed9be2bb 100644 (file)
@@ -990,10 +990,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