[bug report] BUG libfc_em (Not tainted): Objects remaining in libfc_em on __kmem_cache_shutdown()

From: Guangwu Zhang
Date: Thu May 04 2023 - 20:09:20 EST


Hi,
I found kernel panic issue with latest linux-block/for-next.
repo : https://git.kernel.org/pub/scm/linux/kernel/git/axboe/linux-block.git
Merge branch 'for-6.4/block' into for-next

Reproducer:
1. found qedf HBA host
2. create npiv port
3. remove some modules
modprobe -r qedf
modprobe -r libfcoe
modprobe -r libfc
4. remove npiv port

=============================================================================
[ 218.400452] BUG libfc_em (Not tainted): Objects remaining in
libfc_em on __kmem_cache_shutdown()
[ 218.410255] -----------------------------------------------------------------------------
[ 218.410255]
[ 218.421028] Slab 0xffffda6cc4444f00 objects=36 used=4
fp=0xffff92381113ea40
flags=0x17ffffc0010200(slab|head|node=0|zone=2|lastcpupid=0x1fffff)
[ 218.435392] CPU: 22 PID: 3794 Comm: modprobe Kdump: loaded Not
tainted 6.3.0+ #1
[ 218.443645] Hardware name: Dell Inc. PowerEdge R730/0H21J3, BIOS
2.16.0 07/20/2022
[ 218.452091] Call Trace:
[ 218.454817] <TASK>
[ 218.457154] dump_stack_lvl+0x33/0x50
[ 218.461240] slab_err+0xc3/0x130
[ 218.464842] ? pick_next_task+0x57/0x9b0
[ 218.469219] ? check_preempt_curr+0x5d/0x70
[ 218.473883] ? ttwu_do_activate+0x6b/0x220
[ 218.478453] ? __switch_to_asm+0x3a/0x80
[ 218.482831] __kmem_cache_shutdown+0x159/0x310
[ 218.487789] kmem_cache_destroy+0x51/0x160
[ 218.492361] libfc_exit+0xa/0x280 [libfc]
[ 218.496848] __do_sys_delete_module.constprop.0+0x17a/0x2f0
[ 218.503067] ? syscall_trace_enter.constprop.0+0x126/0x1a0
[ 218.509188] do_syscall_64+0x5c/0x90
[ 218.513177] ? exit_to_user_mode_prepare+0xc4/0xd0
[ 218.518522] ? syscall_exit_to_user_mode+0x12/0x30
[ 218.523866] ? do_syscall_64+0x69/0x90
[ 218.528046] ? exc_page_fault+0x65/0x150
[ 218.532420] entry_SYSCALL_64_after_hwframe+0x72/0xdc
[ 218.538058] RIP: 0033:0x7f9fafa3f5ab
[ 218.542046] Code: 73 01 c3 48 8b 0d 75 a8 1b 00 f7 d8 64 89 01 48
83 c8 ff c3 66 2e 0f 1f 84 00 00 00 00 00 90 f3 0f 1e fa b8 b0 00 00
00 0f 05 <48> 3d 01 f0 ff ff 73 01 c3 48 8b 0d 45 a8 1b 00 f7 d8 64 89
01 48
[ 218.563001] RSP: 002b:00007fff16e560c8 EFLAGS: 00000206 ORIG_RAX:
00000000000000b0
[ 218.571448] RAX: ffffffffffffffda RBX: 000055631b3dc510 RCX: 00007f9fafa3f5ab
[ 218.579407] RDX: 0000000000000000 RSI: 0000000000000800 RDI: 000055631b3dc578
[ 218.587367] RBP: 000055631b3dc510 R08: 0000000000000000 R09: 0000000000000000
[ 218.595328] R10: 00007f9fafb9eac0 R11: 0000000000000206 R12: 000055631b3dc578
[ 218.603287] R13: 0000000000000000 R14: 000055631b3dbda8 R15: 00007fff16e58458
[ 218.611248] </TASK>
[ 218.613683] Disabling lock debugging due to kernel taint
[ 218.619610] Object 0xffff92381113c740 @offset=1856
[ 218.624953] Allocated in mempool_init_node+0x92/0xd0 age=205368 cpu=0 pid=391
[ 218.632917] mempool_init_node+0x92/0xd0
[ 218.637291] mempool_create+0x56/0x80
[ 218.641374] fc_exch_mgr_alloc+0xd4/0x220 [libfc]
[ 218.646631] 0xffffffffc0a10cbf
[ 218.650133] 0xffffffffc0a12ce1
[ 218.653633] local_pci_probe+0x46/0xa0
[ 218.657813] work_for_cpu_fn+0x16/0x20
[ 218.661994] process_one_work+0x1e5/0x3f0
[ 218.666467] worker_thread+0x1c4/0x3a0
[ 218.670647] kthread+0xe2/0x110
[ 218.674150] ret_from_fork+0x2c/0x50
[ 218.678138] Object 0xffff92381113d8c0 @offset=6336
[ 218.683481] Allocated in mempool_init_node+0x92/0xd0 age=205133 cpu=0 pid=391
[ 218.691442] mempool_init_node+0x92/0xd0
[ 218.695816] mempool_create+0x56/0x80
[ 218.699898] fc_exch_mgr_alloc+0xd4/0x220 [libfc]
[ 218.705155] 0xffffffffc0a10cbf
[ 218.708655] 0xffffffffc0a12ce1
[ 218.712156] local_pci_probe+0x46/0xa0
[ 218.716334] work_for_cpu_fn+0x16/0x20
[ 218.720515] process_one_work+0x1e5/0x3f0
[ 218.724986] worker_thread+0x1c4/0x3a0
[ 218.729167] kthread+0xe2/0x110
[ 218.732668] ret_from_fork+0x2c/0x50
[ 218.736656] Object 0xffff92381113da80 @offset=6784
[ 218.741998] Allocated in mempool_init_node+0x92/0xd0 age=205192 cpu=0 pid=391
[ 218.749959] mempool_init_node+0x92/0xd0
[ 218.754333] mempool_create+0x56/0x80
[ 218.758416] fc_exch_mgr_alloc+0xd4/0x220 [libfc]
[ 218.763673] 0xffffffffc0a10cbf
[ 218.767173] 0xffffffffc0a12ce1
[ 218.770674] local_pci_probe+0x46/0xa0
[ 218.774852] work_for_cpu_fn+0x16/0x20
[ 218.779031] process_one_work+0x1e5/0x3f0
[ 218.783504] worker_thread+0x1c4/0x3a0
[ 218.787683] kthread+0xe2/0x110
[ 218.791184] ret_from_fork+0x2c/0x50
[ 218.795172] Object 0xffff92381113dfc0 @offset=8128
[ 218.800514] Allocated in mempool_init_node+0x92/0xd0 age=205544 cpu=0 pid=391
[ 218.808477] mempool_init_node+0x92/0xd0
[ 218.812851] mempool_create+0x56/0x80
[ 218.816933] fc_exch_mgr_alloc+0xd4/0x220 [libfc]
[ 218.822187] 0xffffffffc0a10cbf
[ 218.825688] 0xffffffffc0a12ce1
[ 218.829188] local_pci_probe+0x46/0xa0
[ 218.833367] work_for_cpu_fn+0x16/0x20
[ 218.837547] process_one_work+0x1e5/0x3f0
[ 218.842018] worker_thread+0x1c4/0x3a0
[ 218.846197] kthread+0xe2/0x110
[ 218.849698] ret_from_fork+0x2c/0x50