The linux-next commit [1] introduced a lot of memory leaks while running LTP fs
tests (/opt/ltp/runltp -f fs). Reverted the commit fixed the problem. It seems
the new code wq->rescuer to NULL without free it first, so later rcu_free_wq()
is unable to free it.

unreferenced object 0xffff8f822e7c8428 (size 192):
  comm "fs_fill", pid 8310, jiffies 4294965449 (age 494.720s)
  hex dump (first 32 bytes):
    28 84 7c 2e 82 8f ff ff 28 84 7c 2e 82 8f ff ff  (.|.....(.|.....
    00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ................
  backtrace:
    [<0000000030795d2f>] kmem_cache_alloc_node_trace+0x153/0x470
    [<000000000398512e>] alloc_worker+0x21/0x50
    [<000000001934cb3a>] init_rescuer.part.4+0x1d/0xb0
    [<00000000f36417e5>] alloc_workqueue+0x336/0x5f3
    [<0000000011066bf3>] ext4_fill_super+0x1eec/0x2f70 [ext4]
    [<000000001fdee6fd>] mount_bdev+0x191/0x1c0
    [<00000000e2d3e265>] ext4_mount+0x15/0x20 [ext4]
    [<00000000631fe1d9>] legacy_get_tree+0x34/0x60
    [<00000000ee947c38>] vfs_get_tree+0x27/0xb0
    [<00000000f4bcb594>] do_mount+0x8a0/0xae0
    [<0000000005dd5056>] ksys_mount+0xb6/0xd0
    [<00000000fb14e10a>] __x64_sys_mount+0x25/0x30
    [<000000009fb1dd3e>] do_syscall_64+0x6d/0x488
    [<00000000a822a6c4>] entry_SYSCALL_64_after_hwframe+0x49/0xbe
unreferenced object 0xffff8f824c314218 (size 192):
  comm "fs_fill", pid 8310, jiffies 4294966011 (age 489.100s)
  hex dump (first 32 bytes):
    18 42 31 4c 82 8f ff ff 18 42 31 4c 82 8f ff ff  .B1L.....B1L....
    00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ................
  backtrace:
    [<0000000030795d2f>] kmem_cache_alloc_node_trace+0x153/0x470
    [<000000000398512e>] alloc_worker+0x21/0x50
    [<000000001934cb3a>] init_rescuer.part.4+0x1d/0xb0
    [<00000000f36417e5>] alloc_workqueue+0x336/0x5f3
    [<000000000b6d2e88>] xfs_init_mount_workqueues+0x2a/0x150 [xfs]
    [<0000000014c756cd>] xfs_fs_fill_super+0x311/0x760 [xfs]
    [<000000001fdee6fd>] mount_bdev+0x191/0x1c0
    [<00000000d0aa6706>] xfs_fs_mount+0x15/0x20 [xfs]
    [<00000000631fe1d9>] legacy_get_tree+0x34/0x60
    [<00000000ee947c38>] vfs_get_tree+0x27/0xb0
    [<00000000f4bcb594>] do_mount+0x8a0/0xae0
    [<0000000005dd5056>] ksys_mount+0xb6/0xd0
    [<00000000fb14e10a>] __x64_sys_mount+0x25/0x30
    [<000000009fb1dd3e>] do_syscall_64+0x6d/0x488
    [<00000000a822a6c4>] entry_SYSCALL_64_after_hwframe+0x49/0xbe

[1] https://lore.kernel.org/lkml/[email protected]
k.com/

Reply via email to