• M
    slub: missing test for partial pages flush work in flush_all() · 02e1a9cd
    majianpeng 提交于
    I found some kernel messages such as:
    
        SLUB raid5-md127: kmem_cache_destroy called for cache that still has objects.
        Pid: 6143, comm: mdadm Tainted: G           O 3.4.0-rc6+        #75
        Call Trace:
        kmem_cache_destroy+0x328/0x400
        free_conf+0x2d/0xf0 [raid456]
        stop+0x41/0x60 [raid456]
        md_stop+0x1a/0x60 [md_mod]
        do_md_stop+0x74/0x470 [md_mod]
        md_ioctl+0xff/0x11f0 [md_mod]
        blkdev_ioctl+0xd8/0x7a0
        block_ioctl+0x3b/0x40
        do_vfs_ioctl+0x96/0x560
        sys_ioctl+0x91/0xa0
        system_call_fastpath+0x16/0x1b
    
    Then using kmemleak I found these messages:
    
        unreferenced object 0xffff8800b6db7380 (size 112):
          comm "mdadm", pid 5783, jiffies 4294810749 (age 90.589s)
          hex dump (first 32 bytes):
            01 01 db b6 ad 4e ad de ff ff ff ff ff ff ff ff  .....N..........
            ff ff ff ff ff ff ff ff 98 40 4a 82 ff ff ff ff  .........@J.....
          backtrace:
            kmemleak_alloc+0x21/0x50
            kmem_cache_alloc+0xeb/0x1b0
            kmem_cache_open+0x2f1/0x430
            kmem_cache_create+0x158/0x320
            setup_conf+0x649/0x770 [raid456]
            run+0x68b/0x840 [raid456]
            md_run+0x529/0x940 [md_mod]
            do_md_run+0x18/0xc0 [md_mod]
            md_ioctl+0xba8/0x11f0 [md_mod]
            blkdev_ioctl+0xd8/0x7a0
            block_ioctl+0x3b/0x40
            do_vfs_ioctl+0x96/0x560
            sys_ioctl+0x91/0xa0
            system_call_fastpath+0x16/0x1b
    
    This bug was introduced by commit a8364d55 ("slub: only IPI CPUs that
    have per cpu obj to flush"), which did not include checks for per cpu
    partial pages being present on a cpu.
    Signed-off-by: Nmajianpeng <majianpeng@gmail.com>
    Cc: Gilad Ben-Yossef <gilad@benyossef.com>
    Acked-by: NChristoph Lameter <cl@linux.com>
    Cc: Pekka Enberg <penberg@kernel.org>
    Tested-by: NJeff Layton <jlayton@redhat.com>
    Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
    Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
    02e1a9cd
slub.c 129.3 KB