gfs2: new slab for transactions
This patch adds a new slab for gfs2 transactions. That allows us to reduce kernel memory fragmentation, have better organization of data for analysis of vmcore dumps. A new centralized function is added to free the slab objects, and it exposes use-after-free by giving warnings if a transaction is freed while it still has bd elements attached to its buffers or ail lists. We make sure to initialize those transaction ail lists so we can check their integrity when freeing. At a later time, we should add a slab initialization function to make it more efficient, but for this initial patch I wanted to minimize the impact. Signed-off-by: Bob Peterson <rpeterso@redhat.com> Signed-off-by: Andreas Gruenbacher <agruenba@redhat.com>
This commit is contained in:

committed by
Andreas Gruenbacher

parent
cbcc89b630
commit
b839dadae8
@@ -143,6 +143,12 @@ static int __init init_gfs2_fs(void)
|
||||
if (!gfs2_qadata_cachep)
|
||||
goto fail_cachep7;
|
||||
|
||||
gfs2_trans_cachep = kmem_cache_create("gfs2_trans",
|
||||
sizeof(struct gfs2_trans),
|
||||
0, 0, NULL);
|
||||
if (!gfs2_trans_cachep)
|
||||
goto fail_cachep8;
|
||||
|
||||
error = register_shrinker(&gfs2_qd_shrinker);
|
||||
if (error)
|
||||
goto fail_shrinker;
|
||||
@@ -194,6 +200,8 @@ fail_fs2:
|
||||
fail_fs1:
|
||||
unregister_shrinker(&gfs2_qd_shrinker);
|
||||
fail_shrinker:
|
||||
kmem_cache_destroy(gfs2_trans_cachep);
|
||||
fail_cachep8:
|
||||
kmem_cache_destroy(gfs2_qadata_cachep);
|
||||
fail_cachep7:
|
||||
kmem_cache_destroy(gfs2_quotad_cachep);
|
||||
@@ -236,6 +244,7 @@ static void __exit exit_gfs2_fs(void)
|
||||
rcu_barrier();
|
||||
|
||||
mempool_destroy(gfs2_page_pool);
|
||||
kmem_cache_destroy(gfs2_trans_cachep);
|
||||
kmem_cache_destroy(gfs2_qadata_cachep);
|
||||
kmem_cache_destroy(gfs2_quotad_cachep);
|
||||
kmem_cache_destroy(gfs2_rgrpd_cachep);
|
||||
|
Reference in New Issue
Block a user