Skip to content
  • David Rientjes's avatar
    fs, jfs: remove slab object constructor · ee146245
    David Rientjes authored
    
    
    Mempools based on slab caches with object constructors are risky because
    element allocation can happen either from the slab cache itself, meaning
    the constructor is properly called before returning, or from the mempool
    reserve pool, meaning the constructor is not called before returning,
    depending on the allocation context.
    
    For this reason, we should disallow creating mempools based on slab caches
    that have object constructors.  Callers of mempool_alloc() will be
    responsible for properly initializing the returned element.
    
    Then, it doesn't matter if the element came from the slab cache or the
    mempool reserved pool.
    
    The only occurrence of a mempool being based on a slab cache with an
    object constructor in the tree is in fs/jfs/jfs_metapage.c.  Remove it and
    properly initialize the element in alloc_metapage().
    
    At the same time, META_free is never used, so remove it as well.
    
    Signed-off-by: default avatarDavid Rientjes <rientjes@google.com>
    Acked-by: default avatarDave Kleikamp <dave.kleikamp@oracle.com>
    Cc: Christoph Hellwig <hch@lst.de>
    Cc: Sebastian Ott <sebott@linux.vnet.ibm.com>
    Cc: Mikulas Patocka <mpatocka@redhat.com>
    Cc: Catalin Marinas <catalin.marinas@arm.com>
    Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
    Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
    ee146245