linux-btrfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* btrfs/011 possible circular locking dependency detected
@ 2018-10-03 15:23 Anand Jain
  0 siblings, 0 replies; only message in thread
From: Anand Jain @ 2018-10-03 15:23 UTC (permalink / raw)
  To: linux-btrfs


btrfs/011 generates possible circular locking dependency warning [1] on 
the latest 4.19-rc3, tracing back leads to

1c542f38ab8d mm: Introduce kvcalloc()

[1]
-----------------------------------------------------------
[  233.710021] ======================================================
[  233.710303] WARNING: possible circular locking dependency detected
[  233.710574] 4.17.0+ #4 Not tainted
[  233.710757] ------------------------------------------------------
[  233.711006] kswapd0/749 is trying to acquire lock:
[  233.711244] 00000000e4661f1f (&delayed_node->mutex){+.+.}, at: 
__btrfs_release_delayed_node+0x3a/0x210 [btrfs]
[  233.711628]
but task is already holding lock:
[  233.711869] 0000000046873fcd (fs_reclaim){+.+.}, at: 
__fs_reclaim_acquire+0x5/0x40
[  233.712906]
which lock already depends on the new lock.

[  233.713055]
the existing dependency chain (in reverse order) is:
[  233.713886]
-> #3 (fs_reclaim){+.+.}:
[  233.714080]        kmem_cache_alloc+0x29/0x240
[  233.714414]        btrfs_alloc_inode+0x24/0x260 [btrfs]
[  233.715212]        alloc_inode+0x1b/0x90
[  233.716085]        new_inode_pseudo+0xc/0x60
[  233.716503]        new_inode+0x12/0x30
[  233.719126]        iget5_locked+0x44/0x80
[  233.719605]        btrfs_iget+0x60/0x6e0 [btrfs]
[  233.720109]        __lookup_free_space_inode+0x102/0x160 [btrfs]
[  233.720543]        lookup_free_space_inode+0x63/0xe0 [btrfs]
[  233.720885]        load_free_space_cache+0x68/0x190 [btrfs]
[  233.721167]        cache_block_group+0x1d1/0x460 [btrfs]
[  233.721490]        find_free_extent+0x10bd/0x1460 [btrfs]
[  233.721824]        btrfs_reserve_extent+0xf6/0x190 [btrfs]
[  233.722150]        btrfs_alloc_tree_block+0x13e/0x520 [btrfs]
[  233.722483]        __btrfs_cow_block+0x128/0x5e0 [btrfs]
[  233.722807]        btrfs_cow_block+0xe9/0x260 [btrfs]
[  233.723074]        commit_cowonly_roots+0x55/0x2b0 [btrfs]
[  233.723413]        btrfs_commit_transaction+0x3b4/0xa20 [btrfs]
[  233.723760]        close_ctree+0x2b1/0x310 [btrfs]
[  233.724059]        generic_shutdown_super+0x67/0x110
[  233.724361]        kill_anon_super+0xe/0x20
[  233.724663]        btrfs_kill_super+0x13/0x100 [btrfs]
[  233.724973]        deactivate_locked_super+0x3a/0x70
[  233.725289]        cleanup_mnt+0x3b/0x70
[  233.725568]        task_work_run+0x89/0xa0
[  233.725850]        exit_to_usermode_loop+0x64/0x9c
[  233.726151]        do_syscall_64+0x12d/0x180
[  233.726438]        entry_SYSCALL_64_after_hwframe+0x49/0xbe
[  233.726756]
-> #2 (&caching_ctl->mutex){+.+.}:
[  233.727169]        cache_block_group+0x1c6/0x460 [btrfs]
[  233.727455]        find_free_extent+0x10bd/0x1460 [btrfs]
[  233.727757]        btrfs_reserve_extent+0xf6/0x190 [btrfs]
[  233.728370]        btrfs_alloc_tree_block+0x13e/0x520 [btrfs]
[  233.728850]        __btrfs_cow_block+0x128/0x5e0 [btrfs]
[  233.729364]        btrfs_cow_block+0xe9/0x260 [btrfs]
[  233.729774]        btrfs_search_slot+0x1ff/0x9d0 [btrfs]
[  233.732271]        btrfs_insert_empty_items+0x5e/0xb0 [btrfs]
[  233.732736]        btrfs_uuid_tree_add+0x1b6/0x2e0 [btrfs]
[  233.733089]        btrfs_uuid_scan_kthread+0x198/0x330 [btrfs]
[  233.733418]        kthread+0xf8/0x130
[  233.733698]        ret_from_fork+0x3a/0x50
[  233.733971]
-> #1 (&space_info->groups_sem){++++}:
[  233.734429]        find_free_extent+0xdac/0x1460 [btrfs]
[  233.734756]        btrfs_reserve_extent+0xf6/0x190 [btrfs]
[  233.735129]        btrfs_alloc_tree_block+0x13e/0x520 [btrfs]
[  233.735465]        split_leaf+0x234/0x6f0 [btrfs]
[  233.735807]        btrfs_search_slot+0x95d/0x9d0 [btrfs]
[  233.736111]        btrfs_insert_empty_items+0x5e/0xb0 [btrfs]
[  233.736440]        btrfs_insert_delayed_items+0x98/0x450 [btrfs]
[  233.736755]        btrfs_async_run_delayed_root+0xed/0x200 [btrfs]
[  233.737121]        normal_work_helper+0x1bd/0x5e0 [btrfs]
[  233.737492]        process_one_work+0x1f4/0x5b0
[  233.737788]        worker_thread+0x46/0x3d0
[  233.738041]        kthread+0xf8/0x130
[  233.738333]        ret_from_fork+0x3a/0x50
[  233.738629]
-> #0 (&delayed_node->mutex){+.+.}:
[  233.738991]        __mutex_lock+0x6e/0x880
[  233.739281]        __btrfs_release_delayed_node+0x3a/0x210 [btrfs]
[  233.739592]        btrfs_evict_inode+0x232/0x5d0 [btrfs]
[  233.739893]        evict+0xc4/0x190
[  233.740144]        dispose_list+0x35/0x50
[  233.740395]        prune_icache_sb+0x52/0x70
[  233.740695]        super_cache_scan+0x13c/0x190
[  233.740985]        shrink_slab.part.72.constprop.93+0x19b/0x530
[  233.741372]        shrink_node+0x98/0x2e0
[  233.741619]        balance_pgdat+0x167/0x320
[  233.741896]        kswapd+0x189/0x560
[  233.742149]        kthread+0xf8/0x130
[  233.742422]        ret_from_fork+0x3a/0x50
[  233.742670]
other info that might help us debug this:

[  233.743146] Chain exists of:
   &delayed_node->mutex --> &caching_ctl->mutex --> fs_reclaim

[  233.743777]  Possible unsafe locking scenario:

[  233.744837]        CPU0                    CPU1
[  233.745357]        ----                    ----
[  233.745656]   lock(fs_reclaim);
[  233.745883]                                lock(&caching_ctl->mutex);
[  233.746831]                                lock(fs_reclaim);
[  233.747472]   lock(&delayed_node->mutex);
[  233.747780]
  *** DEADLOCK ***

[  233.748382] 3 locks held by kswapd0/749:
[  233.748737]  #0: 0000000046873fcd (fs_reclaim){+.+.}, at: 
__fs_reclaim_acquire+0x5/0x40
[  233.750004]  #1: 00000000cdfa74b4 (shrinker_rwsem){++++}, at: 
shrink_slab.part.72.constprop.93+0x3b/0x530
[  233.750496]  #2: 00000000567f3106 (&type->s_umount_key#47){++++}, at: 
trylock_super+0x16/0x50
[  233.750939]
stack backtrace:
[  233.751270] CPU: 0 PID: 749 Comm: kswapd0 Not tainted 4.17.0+ #4
[  233.751560] Hardware name: innotek GmbH VirtualBox/VirtualBox, BIOS 
VirtualBox 12/01/2006
[  233.751973] Call Trace:
[  233.752233]  dump_stack+0x5e/0x8b
[  233.752520]  print_circular_bug.isra.38+0x1f1/0x1fe
[  233.752831]  __lock_acquire+0x148c/0x1760
[  233.753108]  ? ret_from_fork+0x3a/0x50
[  233.753394]  lock_acquire+0xb0/0x1d0
[  233.753696]  ? __btrfs_release_delayed_node+0x3a/0x210 [btrfs]
[  233.754073]  ? __btrfs_release_delayed_node+0x3a/0x210 [btrfs]
[  233.754407]  __mutex_lock+0x6e/0x880
[  233.754738]  ? __btrfs_release_delayed_node+0x3a/0x210 [btrfs]
[  233.755944]  ? __lock_acquire+0xf37/0x1760
[  233.756282]  ? __btrfs_release_delayed_node+0x3a/0x210 [btrfs]
[  233.756608]  ? find_held_lock+0x31/0xa0
[  233.758274]  ? btrfs_evict_inode+0x1fc/0x5d0 [btrfs]
[  233.759134]  __btrfs_release_delayed_node+0x3a/0x210 [btrfs]
[  233.759471]  btrfs_evict_inode+0x232/0x5d0 [btrfs]
[  233.759803]  ? evict+0xae/0x190
[  233.760076]  evict+0xc4/0x190
[  233.760334]  dispose_list+0x35/0x50
[  233.760716]  prune_icache_sb+0x52/0x70
[  233.761071]  super_cache_scan+0x13c/0x190
[  233.761335]  shrink_slab.part.72.constprop.93+0x19b/0x530
[  233.761642]  shrink_node+0x98/0x2e0
[  233.761909]  balance_pgdat+0x167/0x320
[  233.762167]  kswapd+0x189/0x560
[  233.762397]  ? wait_woken+0x80/0x80
[  233.762700]  kthread+0xf8/0x130
[  233.762938]  ? balance_pgdat+0x320/0x320
[  233.763225]  ? kthread_delayed_work_timer_fn+0x80/0x80
[  233.763566]  ret_from_fork+0x3a/0x50

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2018-10-03 15:23 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-10-03 15:23 btrfs/011 possible circular locking dependency detected Anand Jain

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).