* Lockdep splat with v4.18.6
@ 2018-07-26 22:09 Ross Zwisler
2018-07-27 0:15 ` Anand Jain
0 siblings, 1 reply; 2+ messages in thread
From: Ross Zwisler @ 2018-07-26 22:09 UTC (permalink / raw)
To: Chris Mason, Josef Bacik, David Sterba, linux-btrfs, Ross Zwisler
[-- Attachment #1: Type: text/plain, Size: 375 bytes --]
I was testing my new xfstest posted here:
https://lists.01.org/pipermail/linux-nvdimm/2018-July/016850.html
against a btrfs test device + scrach device setup, and hit a lockdep
splat. I'm using vanilla v4.18.6.
I've attached the splats to this mail, one just as it happened in
dmesg and one passed through kasan_symbolize.py for files, line
numbers, etc.
Thanks,
- Ross
[-- Attachment #2: btrfs_splat --]
[-- Type: application/octet-stream, Size: 10828 bytes --]
[ 35.478141] run fstests generic/999 at 2018-07-26 16:00:32
[ 36.009205] BTRFS info (device pmem0p2): disk space caching is enabled
[ 36.009929] BTRFS info (device pmem0p2): has skinny extents
[ 36.014376] BTRFS info (device pmem0p2): enabling ssd optimizations
[ 36.468163]
[ 36.468348] ======================================================
[ 36.468951] WARNING: possible circular locking dependency detected
[ 36.469534] 4.18.0-rc6 #2 Not tainted
[ 36.469938] ------------------------------------------------------
[ 36.470573] t_mmap_collisio/1500 is trying to acquire lock:
[ 36.471144] 00000000a2c97fe0 (&fs_devs->device_list_mutex){+.+.}, at: btrfs_finish_chunk_alloc+0xe6/0x490
[ 36.472112]
[ 36.472112] but task is already holding lock:
[ 36.472706] 00000000864d154c (sb_pagefaults#2){.+.+}, at: btrfs_page_mkwrite+0x68/0x540
[ 36.473514]
[ 36.473514] which lock already depends on the new lock.
[ 36.473514]
[ 36.474286]
[ 36.474286] the existing dependency chain (in reverse order) is:
[ 36.475029]
[ 36.475029] -> #4 (sb_pagefaults#2){.+.+}:
[ 36.475610] __sb_start_write+0x145/0x200
[ 36.476069] btrfs_page_mkwrite+0x68/0x540
[ 36.476536] do_page_mkwrite+0x37/0xd0
[ 36.476981] __handle_mm_fault+0xcc1/0x1310
[ 36.477452] handle_mm_fault+0x1ba/0x3c0
[ 36.477914] __get_user_pages+0x1ce/0x720
[ 36.478370] get_user_pages_unlocked+0x143/0x1c0
[ 36.478894] get_user_pages_fast+0xad/0x140
[ 36.479398] iov_iter_get_pages+0xc3/0x2f0
[ 36.479884] do_blockdev_direct_IO+0x1ba2/0x2b50
[ 36.480429] __blockdev_direct_IO+0x2e/0x30
[ 36.480947] btrfs_direct_IO+0x16b/0x410
[ 36.481394] generic_file_read_iter+0xce/0xda0
[ 36.481882] __vfs_read+0x109/0x180
[ 36.482274] vfs_read+0xa3/0x150
[ 36.482652] ksys_pread64+0x79/0x90
[ 36.483042] __x64_sys_pread64+0x1e/0x20
[ 36.483475] do_syscall_64+0x65/0x220
[ 36.483892] entry_SYSCALL_64_after_hwframe+0x49/0xbe
[ 36.484427]
[ 36.484427] -> #3 (&mm->mmap_sem){++++}:
[ 36.484969] __might_fault+0x68/0x90
[ 36.485370] _copy_from_user+0x23/0xa0
[ 36.485795] scsi_cmd_ioctl+0x2c2/0x4a0
[ 36.486220] scsi_cmd_blk_ioctl+0x54/0x70
[ 36.486672] cdrom_ioctl+0x41/0x1032
[ 36.487074] sr_block_ioctl+0x84/0xc0
[ 36.487484] blkdev_ioctl+0x4ff/0x9b0
[ 36.487901] block_ioctl+0x43/0x50
[ 36.488287] do_vfs_ioctl+0xa9/0x6d0
[ 36.488696] ksys_ioctl+0x75/0x80
[ 36.489072] __x64_sys_ioctl+0x1a/0x20
[ 36.489482] do_syscall_64+0x65/0x220
[ 36.489899] entry_SYSCALL_64_after_hwframe+0x49/0xbe
[ 36.490434]
[ 36.490434] -> #2 (sr_mutex){+.+.}:
[ 36.490924] __mutex_lock+0x7d/0xa60
[ 36.491318] mutex_lock_nested+0x1b/0x20
[ 36.491754] sr_block_open+0x29/0xe0
[ 36.492149] __blkdev_get+0xed/0x530
[ 36.492542] blkdev_get+0x146/0x3b0
[ 36.492935] blkdev_open+0x9f/0xb0
[ 36.493315] do_dentry_open+0x1d7/0x310
[ 36.493741] vfs_open+0x4f/0x80
[ 36.494096] path_openat+0x56a/0xc80
[ 36.494495] do_filp_open+0x9b/0x110
[ 36.494904] do_sys_open+0x1ba/0x250
[ 36.495297] __x64_sys_openat+0x20/0x30
[ 36.495722] do_syscall_64+0x65/0x220
[ 36.496126] entry_SYSCALL_64_after_hwframe+0x49/0xbe
[ 36.496666]
[ 36.496666] -> #1 (&bdev->bd_mutex){+.+.}:
[ 36.497205] __mutex_lock+0x7d/0xa60
[ 36.497613] mutex_lock_nested+0x1b/0x20
[ 36.498039] __blkdev_get+0x7b/0x530
[ 36.498444] blkdev_get+0x242/0x3b0
[ 36.498843] blkdev_get_by_path+0x53/0x90
[ 36.499281] btrfs_get_bdev_and_sb+0x20/0xb0
[ 36.499769] open_fs_devices+0x87/0x290
[ 36.500185] btrfs_open_devices+0x8c/0x90
[ 36.500625] btrfs_mount_root+0x2d8/0x7a0
[ 36.501058] mount_fs+0x37/0x150
[ 36.501418] vfs_kern_mount.part.27+0x5d/0x160
[ 36.501893] vfs_kern_mount+0x13/0x20
[ 36.502294] btrfs_mount+0x175/0x912
[ 36.502696] mount_fs+0x37/0x150
[ 36.503053] vfs_kern_mount.part.27+0x5d/0x160
[ 36.503525] do_mount+0x65d/0xdc0
[ 36.503900] ksys_mount+0x98/0xe0
[ 36.504265] __x64_sys_mount+0x25/0x30
[ 36.504687] do_syscall_64+0x65/0x220
[ 36.505086] entry_SYSCALL_64_after_hwframe+0x49/0xbe
[ 36.505613]
[ 36.505613] -> #0 (&fs_devs->device_list_mutex){+.+.}:
[ 36.506243] lock_acquire+0xa3/0x210
[ 36.506641] __mutex_lock+0x7d/0xa60
[ 36.507033] mutex_lock_nested+0x1b/0x20
[ 36.507454] btrfs_finish_chunk_alloc+0xe6/0x490
[ 36.507952] btrfs_create_pending_block_groups+0x13c/0x260
[ 36.508522] __btrfs_end_transaction+0x91/0x2e0
[ 36.509014] btrfs_end_transaction+0x10/0x20
[ 36.509476] btrfs_alloc_data_chunk_ondemand+0xfd/0x4b0
[ 36.510021] btrfs_check_data_free_space+0x58/0xb0
[ 36.510517] btrfs_delalloc_reserve_space+0x25/0x70
[ 36.511075] btrfs_page_mkwrite+0x84/0x540
[ 36.511527] do_page_mkwrite+0x37/0xd0
[ 36.511947] __handle_mm_fault+0xcc1/0x1310
[ 36.512400] handle_mm_fault+0x1ba/0x3c0
[ 36.512840] __get_user_pages+0x1ce/0x720
[ 36.513268] get_user_pages_unlocked+0x143/0x1c0
[ 36.513774] get_user_pages_fast+0xad/0x140
[ 36.514221] iov_iter_get_pages+0xc3/0x2f0
[ 36.514684] do_blockdev_direct_IO+0x1ba2/0x2b50
[ 36.515171] __blockdev_direct_IO+0x2e/0x30
[ 36.515637] btrfs_direct_IO+0x16b/0x410
[ 36.516065] generic_file_read_iter+0xce/0xda0
[ 36.516542] __vfs_read+0x109/0x180
[ 36.516934] vfs_read+0xa3/0x150
[ 36.517289] ksys_pread64+0x79/0x90
[ 36.517687] __x64_sys_pread64+0x1e/0x20
[ 36.518109] do_syscall_64+0x65/0x220
[ 36.518519] entry_SYSCALL_64_after_hwframe+0x49/0xbe
[ 36.519052]
[ 36.519052] other info that might help us debug this:
[ 36.519052]
[ 36.519836] Chain exists of:
[ 36.519836] &fs_devs->device_list_mutex --> &mm->mmap_sem --> sb_pagefaults#2
[ 36.519836]
[ 36.520934] Possible unsafe locking scenario:
[ 36.520934]
[ 36.521491] CPU0 CPU1
[ 36.521917] ---- ----
[ 36.522335] lock(sb_pagefaults#2);
[ 36.522685] lock(&mm->mmap_sem);
[ 36.523206] lock(sb_pagefaults#2);
[ 36.523779] lock(&fs_devs->device_list_mutex);
[ 36.524192]
[ 36.524192] *** DEADLOCK ***
[ 36.524192]
[ 36.524743] 3 locks held by t_mmap_collisio/1500:
[ 36.525160] #0: 000000004eaddde7 (&mm->mmap_sem){++++}, at: get_user_pages_unlocked+0x62/0x1c0
[ 36.525951] #1: 00000000864d154c (sb_pagefaults#2){.+.+}, at: btrfs_page_mkwrite+0x68/0x540
[ 36.526725] #2: 000000008adcd4ac (sb_internal#2){.+.+}, at: start_transaction+0x2f7/0x4c0
[ 36.527453]
[ 36.527453] stack backtrace:
[ 36.527868] CPU: 10 PID: 1500 Comm: t_mmap_collisio Not tainted 4.18.0-rc6 #2
[ 36.528505] Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS rel-1.11.1-0-g0551a4be2c-prebuilt.qemu-project.org 04/01/2014
[ 36.529575] Call Trace:
[ 36.529827] dump_stack+0x8e/0xd5
[ 36.530126] print_circular_bug.isra.38+0x1d8/0x1e6
[ 36.530573] __lock_acquire+0x12ab/0x1350
[ 36.530949] ? __lock_acquire+0x1131/0x1350
[ 36.531329] lock_acquire+0xa3/0x210
[ 36.531671] ? lock_acquire+0xa3/0x210
[ 36.532011] ? btrfs_finish_chunk_alloc+0xe6/0x490
[ 36.532434] ? btrfs_finish_chunk_alloc+0xe6/0x490
[ 36.532888] __mutex_lock+0x7d/0xa60
[ 36.533212] ? btrfs_finish_chunk_alloc+0xe6/0x490
[ 36.533674] ? btrfs_finish_chunk_alloc+0xb9/0x490
[ 36.534102] ? __lock_is_held+0x65/0xb0
[ 36.534458] ? btrfs_finish_chunk_alloc+0xb9/0x490
[ 36.534913] ? btrfs_finish_chunk_alloc+0xb9/0x490
[ 36.535344] mutex_lock_nested+0x1b/0x20
[ 36.535719] ? mutex_lock_nested+0x1b/0x20
[ 36.536086] btrfs_finish_chunk_alloc+0xe6/0x490
[ 36.536515] ? btrfs_insert_item+0x80/0xf0
[ 36.536892] btrfs_create_pending_block_groups+0x13c/0x260
[ 36.537379] __btrfs_end_transaction+0x91/0x2e0
[ 36.537875] btrfs_end_transaction+0x10/0x20
[ 36.538336] btrfs_alloc_data_chunk_ondemand+0xfd/0x4b0
[ 36.538832] btrfs_check_data_free_space+0x58/0xb0
[ 36.539259] btrfs_delalloc_reserve_space+0x25/0x70
[ 36.539730] btrfs_page_mkwrite+0x84/0x540
[ 36.540068] do_page_mkwrite+0x37/0xd0
[ 36.540376] ? __do_fault+0x26/0x160
[ 36.540690] __handle_mm_fault+0xcc1/0x1310
[ 36.541036] handle_mm_fault+0x1ba/0x3c0
[ 36.541359] __get_user_pages+0x1ce/0x720
[ 36.541709] get_user_pages_unlocked+0x143/0x1c0
[ 36.542088] get_user_pages_fast+0xad/0x140
[ 36.542431] iov_iter_get_pages+0xc3/0x2f0
[ 36.542786] do_blockdev_direct_IO+0x1ba2/0x2b50
[ 36.543163] ? kvm_clock_read+0x23/0x40
[ 36.543483] ? kvm_sched_clock_read+0x9/0x20
[ 36.543846] ? can_nocow_extent+0x4a0/0x4a0
[ 36.544193] ? can_nocow_extent+0x4a0/0x4a0
[ 36.544546] ? btrfs_merge_bio_hook+0xb0/0xb0
[ 36.544922] __blockdev_direct_IO+0x2e/0x30
[ 36.545267] ? __blockdev_direct_IO+0x2e/0x30
[ 36.545647] ? btrfs_merge_bio_hook+0xb0/0xb0
[ 36.546004] btrfs_direct_IO+0x16b/0x410
[ 36.546327] ? btrfs_merge_bio_hook+0xb0/0xb0
[ 36.546708] generic_file_read_iter+0xce/0xda0
[ 36.547075] ? __might_sleep+0x4a/0x80
[ 36.547384] __vfs_read+0x109/0x180
[ 36.547694] vfs_read+0xa3/0x150
[ 36.547963] ksys_pread64+0x79/0x90
[ 36.548254] __x64_sys_pread64+0x1e/0x20
[ 36.548597] do_syscall_64+0x65/0x220
[ 36.548903] entry_SYSCALL_64_after_hwframe+0x49/0xbe
[ 36.549318] RIP: 0033:0x7febfea07873
[ 36.549646] Code: 49 89 ca b8 11 00 00 00 0f 05 48 3d 01 f0 ff ff 73 34 c3 48 83 ec 08 e8 ab f1 ff ff 48 89 04 24 49 89 ca b8 11 00 00 00 0f 05 <48> 8b 3c 24 48 89 c2 e8 f1 f1 ff ff 48 89 d0 48 83 c4 08 48 3d 01
[ 36.551197] RSP: 002b:00007febfe02aed0 EFLAGS: 00000293 ORIG_RAX: 0000000000000011
[ 36.551827] RAX: ffffffffffffffda RBX: 0000000000000000 RCX: 00007febfea07873
[ 36.552402] RDX: 0000000000004000 RSI: 00007febff447000 RDI: 0000000000000004
[ 36.552996] RBP: 0000000000004000 R08: 00007febfe3dc1b8 R09: 00007febfe3dc220
[ 36.553646] R10: 0000000000000000 R11: 0000000000000293 R12: 00007ffd0d59866e
[ 36.554296] R13: 00007ffd0d59866f R14: 0000000000000000 R15: 00007ffd0d598670
[ 39.141162] BTRFS info (device pmem0p1): disk space caching is enabled
[ 39.142544] BTRFS info (device pmem0p1): has skinny extents
[ 39.148658] BTRFS info (device pmem0p1): enabling ssd optimizations
[-- Attachment #3: btrfs_splat_symbolized --]
[-- Type: application/octet-stream, Size: 18963 bytes --]
run fstests generic/999 at 2018-07-26 16:00:32
BTRFS info (device pmem0p2): disk space caching is enabled
BTRFS info (device pmem0p2): has skinny extents
BTRFS info (device pmem0p2): enabling ssd optimizations
======================================================
WARNING: possible circular locking dependency detected
4.18.0-rc6 #2 Not tainted
------------------------------------------------------
t_mmap_collisio/1500 is trying to acquire lock:
00000000a2c97fe0 (&fs_devs->device_list_mutex){+.+.}, at:[< none >] btrfs_finish_chunk_alloc+0xe6/0x490 fs/btrfs/volumes.c:4975
but task is already holding lock:
00000000864d154c (sb_pagefaults#2){.+.+}, at:[< inline >] sb_start_pagefault ./include/linux/fs.h:1583
00000000864d154c (sb_pagefaults#2){.+.+}, at:[< none >] btrfs_page_mkwrite+0x68/0x540 fs/btrfs/inode.c:8897
which lock already depends on the new lock.
the existing dependency chain (in reverse order) is:
-> #4 (sb_pagefaults#2){.+.+}:
[< inline >] percpu_down_read_preempt_disable ./include/linux/percpu-rwsem.h:36
[< inline >] percpu_down_read ./include/linux/percpu-rwsem.h:59
[< none >] __sb_start_write+0x145/0x200 fs/super.c:1403
[< inline >] sb_start_pagefault ./include/linux/fs.h:1583
[< none >] btrfs_page_mkwrite+0x68/0x540 fs/btrfs/inode.c:8897
[< none >] do_page_mkwrite+0x37/0xd0 mm/memory.c:2380
[< inline >] do_shared_fault mm/memory.c:3706
[< inline >] do_fault mm/memory.c:3745
[< inline >] handle_pte_fault mm/memory.c:3972
[< none >] __handle_mm_fault+0xcc1/0x1310 mm/memory.c:4096
[< none >] handle_mm_fault+0x1ba/0x3c0 mm/memory.c:4133
[< inline >] faultin_page mm/gup.c:518
[< none >] __get_user_pages+0x1ce/0x720 mm/gup.c:718
[< inline >] __get_user_pages_locked mm/gup.c:889
[< none >] get_user_pages_unlocked+0x143/0x1c0 mm/gup.c:1012
[< none >] get_user_pages_fast+0xad/0x140 mm/gup.c:1863
[< none >] iov_iter_get_pages+0xc3/0x2f0 lib/iov_iter.c:1198
[< inline >] dio_refill_pages fs/direct-io.c:170
[< inline >] dio_get_page fs/direct-io.c:214
[< inline >] do_direct_IO fs/direct-io.c:980
[< none >] do_blockdev_direct_IO+0x1ba2/0x2b50 fs/direct-io.c:1331
[< none >] __blockdev_direct_IO+0x2e/0x30 fs/direct-io.c:1417
[< none >] btrfs_direct_IO+0x16b/0x410 fs/btrfs/inode.c:8629
[< none >] generic_file_read_iter+0xce/0xda0 mm/filemap.c:2341
[< inline >] call_read_iter ./include/linux/fs.h:1787
[< inline >] new_sync_read fs/read_write.c:406
[< none >] __vfs_read+0x109/0x180 fs/read_write.c:418
[< none >] vfs_read+0xa3/0x150 fs/read_write.c:452
[< none >] ksys_pread64+0x79/0x90 fs/read_write.c:626
[< inline >] __do_sys_pread64 fs/read_write.c:636
[< inline >] __se_sys_pread64 fs/read_write.c:633
[< none >] __x64_sys_pread64+0x1e/0x20 fs/read_write.c:633
[< none >] do_syscall_64+0x65/0x220 arch/x86/entry/common.c:290
[< none >] entry_SYSCALL_64_after_hwframe+0x49/0xbe /home/rzwisler/project/linux/arch/x86/entry/entry_64.S:238
-> #3 (&mm->mmap_sem){++++}:
[< none >] __might_fault+0x68/0x90 mm/memory.c:4564
[< none >] _copy_from_user+0x23/0xa0 lib/usercopy.c:10
[< inline >] copy_from_user ./include/linux/uaccess.h:147
[< none >] scsi_cmd_ioctl+0x2c2/0x4a0 block/scsi_ioctl.c:599
[< none >] scsi_cmd_blk_ioctl+0x54/0x70 block/scsi_ioctl.c:710
[< none >] cdrom_ioctl+0x41/0x1032 drivers/cdrom/cdrom.c:3324
[< none >] sr_block_ioctl+0x84/0xc0 drivers/scsi/sr.c:576
[< inline >] __blkdev_driver_ioctl block/ioctl.c:303
[< none >] blkdev_ioctl+0x4ff/0x9b0 block/ioctl.c:601
[< none >] block_ioctl+0x43/0x50 fs/block_dev.c:1880
[< inline >] vfs_ioctl fs/ioctl.c:46
[< none >] do_vfs_ioctl+0xa9/0x6d0 fs/ioctl.c:686
[< none >] ksys_ioctl+0x75/0x80 fs/ioctl.c:701
[< inline >] __do_sys_ioctl fs/ioctl.c:708
[< inline >] __se_sys_ioctl fs/ioctl.c:706
[< none >] __x64_sys_ioctl+0x1a/0x20 fs/ioctl.c:706
[< none >] do_syscall_64+0x65/0x220 arch/x86/entry/common.c:290
[< none >] entry_SYSCALL_64_after_hwframe+0x49/0xbe /home/rzwisler/project/linux/arch/x86/entry/entry_64.S:238
-> #2 (sr_mutex){+.+.}:
[< inline >] __mutex_lock_common kernel/locking/mutex.c:757
[< none >] __mutex_lock+0x7d/0xa60 kernel/locking/mutex.c:894
[< none >] mutex_lock_nested+0x1b/0x20 kernel/locking/mutex.c:909
[< none >] sr_block_open+0x29/0xe0 drivers/scsi/sr.c:530
[< none >] __blkdev_get+0xed/0x530 fs/block_dev.c:1479
[< none >] blkdev_get+0x146/0x3b0 fs/block_dev.c:1614
[< none >] blkdev_open+0x9f/0xb0 fs/block_dev.c:1772
[< none >] do_dentry_open+0x1d7/0x310 fs/open.c:794
[< none >] vfs_open+0x4f/0x80 fs/open.c:908
[< inline >] do_last fs/namei.c:3399
[< none >] path_openat+0x56a/0xc80 fs/namei.c:3539
[< none >] do_filp_open+0x9b/0x110 fs/namei.c:3574
[< none >] do_sys_open+0x1ba/0x250 fs/open.c:1101
[< inline >] __do_sys_openat fs/open.c:1128
[< inline >] __se_sys_openat fs/open.c:1122
[< none >] __x64_sys_openat+0x20/0x30 fs/open.c:1122
[< none >] do_syscall_64+0x65/0x220 arch/x86/entry/common.c:290
[< none >] entry_SYSCALL_64_after_hwframe+0x49/0xbe /home/rzwisler/project/linux/arch/x86/entry/entry_64.S:238
-> #1 (&bdev->bd_mutex){+.+.}:
[< inline >] __mutex_lock_common kernel/locking/mutex.c:757
[< none >] __mutex_lock+0x7d/0xa60 kernel/locking/mutex.c:894
[< none >] mutex_lock_nested+0x1b/0x20 kernel/locking/mutex.c:909
[< none >] __blkdev_get+0x7b/0x530 fs/block_dev.c:1463
[< none >] blkdev_get+0x242/0x3b0 fs/block_dev.c:1614
[< none >] blkdev_get_by_path+0x53/0x90 fs/block_dev.c:1692
[< none >] btrfs_get_bdev_and_sb+0x20/0xb0 fs/btrfs/volumes.c:392
[< inline >] btrfs_open_one_device fs/btrfs/volumes.c:695
[< none >] open_fs_devices+0x87/0x290 fs/btrfs/volumes.c:1112
[< none >] btrfs_open_devices+0x8c/0x90 fs/btrfs/volumes.c:1156
[< none >] btrfs_mount_root+0x2d8/0x7a0 fs/btrfs/super.c:1568
[< none >] mount_fs+0x37/0x150 fs/super.c:1277
[< none >] vfs_kern_mount.part.27+0x5d/0x160 fs/namespace.c:1037
[< none >] vfs_kern_mount+0x13/0x20 fs/namespace.c:1023
[< none >] btrfs_mount+0x175/0x912 fs/btrfs/super.c:1661
[< none >] mount_fs+0x37/0x150 fs/super.c:1277
[< none >] vfs_kern_mount.part.27+0x5d/0x160 fs/namespace.c:1037
[< inline >] vfs_kern_mount fs/namespace.c:2515
[< inline >] do_new_mount fs/namespace.c:2518
[< none >] do_mount+0x65d/0xdc0 fs/namespace.c:2848
[< none >] ksys_mount+0x98/0xe0 fs/namespace.c:3064
[< inline >] __do_sys_mount fs/namespace.c:3078
[< inline >] __se_sys_mount fs/namespace.c:3075
[< none >] __x64_sys_mount+0x25/0x30 fs/namespace.c:3075
[< none >] do_syscall_64+0x65/0x220 arch/x86/entry/common.c:290
[< none >] entry_SYSCALL_64_after_hwframe+0x49/0xbe /home/rzwisler/project/linux/arch/x86/entry/entry_64.S:238
-> #0 (&fs_devs->device_list_mutex){+.+.}:
[< none >] lock_acquire+0xa3/0x210 kernel/locking/lockdep.c:3924
[< inline >] __mutex_lock_common kernel/locking/mutex.c:757
[< none >] __mutex_lock+0x7d/0xa60 kernel/locking/mutex.c:894
[< none >] mutex_lock_nested+0x1b/0x20 kernel/locking/mutex.c:909
[< none >] btrfs_finish_chunk_alloc+0xe6/0x490 fs/btrfs/volumes.c:4975
[< none >] btrfs_create_pending_block_groups+0x13c/0x260 fs/btrfs/extent-tree.c:10209
[< none >] __btrfs_end_transaction+0x91/0x2e0 fs/btrfs/transaction.c:832
[< none >] btrfs_end_transaction+0x10/0x20 fs/btrfs/transaction.c:905
[< none >] btrfs_alloc_data_chunk_ondemand+0xfd/0x4b0 fs/btrfs/extent-tree.c:4294
[< none >] btrfs_check_data_free_space+0x58/0xb0 fs/btrfs/extent-tree.c:4375
[< none >] btrfs_delalloc_reserve_space+0x25/0x70 fs/btrfs/extent-tree.c:6169
[< none >] btrfs_page_mkwrite+0x84/0x540 fs/btrfs/inode.c:8910
[< none >] do_page_mkwrite+0x37/0xd0 mm/memory.c:2380
[< inline >] do_shared_fault mm/memory.c:3706
[< inline >] do_fault mm/memory.c:3745
[< inline >] handle_pte_fault mm/memory.c:3972
[< none >] __handle_mm_fault+0xcc1/0x1310 mm/memory.c:4096
[< none >] handle_mm_fault+0x1ba/0x3c0 mm/memory.c:4133
[< inline >] faultin_page mm/gup.c:518
[< none >] __get_user_pages+0x1ce/0x720 mm/gup.c:718
[< inline >] __get_user_pages_locked mm/gup.c:889
[< none >] get_user_pages_unlocked+0x143/0x1c0 mm/gup.c:1012
[< none >] get_user_pages_fast+0xad/0x140 mm/gup.c:1863
[< none >] iov_iter_get_pages+0xc3/0x2f0 lib/iov_iter.c:1198
[< inline >] dio_refill_pages fs/direct-io.c:170
[< inline >] dio_get_page fs/direct-io.c:214
[< inline >] do_direct_IO fs/direct-io.c:980
[< none >] do_blockdev_direct_IO+0x1ba2/0x2b50 fs/direct-io.c:1331
[< none >] __blockdev_direct_IO+0x2e/0x30 fs/direct-io.c:1417
[< none >] btrfs_direct_IO+0x16b/0x410 fs/btrfs/inode.c:8629
[< none >] generic_file_read_iter+0xce/0xda0 mm/filemap.c:2341
[< inline >] call_read_iter ./include/linux/fs.h:1787
[< inline >] new_sync_read fs/read_write.c:406
[< none >] __vfs_read+0x109/0x180 fs/read_write.c:418
[< none >] vfs_read+0xa3/0x150 fs/read_write.c:452
[< none >] ksys_pread64+0x79/0x90 fs/read_write.c:626
[< inline >] __do_sys_pread64 fs/read_write.c:636
[< inline >] __se_sys_pread64 fs/read_write.c:633
[< none >] __x64_sys_pread64+0x1e/0x20 fs/read_write.c:633
[< none >] do_syscall_64+0x65/0x220 arch/x86/entry/common.c:290
[< none >] entry_SYSCALL_64_after_hwframe+0x49/0xbe /home/rzwisler/project/linux/arch/x86/entry/entry_64.S:238
other info that might help us debug this:
Chain exists of:
&fs_devs->device_list_mutex --> &mm->mmap_sem --> sb_pagefaults#2
Possible unsafe locking scenario:
CPU0 CPU1
---- ----
lock(sb_pagefaults#2);
lock(&mm->mmap_sem);
lock(sb_pagefaults#2);
lock(&fs_devs->device_list_mutex);
*** DEADLOCK ***
3 locks held by t_mmap_collisio/1500:
#0: 000000004eaddde7 (&mm->mmap_sem){++++}, at:[< none >] get_user_pages_unlocked+0x62/0x1c0 mm/gup.c:1011
#1: 00000000864d154c (sb_pagefaults#2){.+.+}, at:[< inline >] sb_start_pagefault ./include/linux/fs.h:1583
#1: 00000000864d154c (sb_pagefaults#2){.+.+}, at:[< none >] btrfs_page_mkwrite+0x68/0x540 fs/btrfs/inode.c:8897
#2: 000000008adcd4ac (sb_internal#2){.+.+}, at:[< inline >] sb_start_intwrite ./include/linux/fs.h:1601
#2: 000000008adcd4ac (sb_internal#2){.+.+}, at:[< none >] start_transaction+0x2f7/0x4c0 fs/btrfs/transaction.c:525
stack backtrace:
CPU: 10 PID: 1500 Comm: t_mmap_collisio Not tainted 4.18.0-rc6 #2
Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS rel-1.11.1-0-g0551a4be2c-prebuilt.qemu-project.org 04/01/2014
Call Trace:
[< inline >] __dump_stack lib/dump_stack.c:77
[< none >] dump_stack+0x8e/0xd5 lib/dump_stack.c:113
[< none >] print_circular_bug.isra.38+0x1d8/0x1e6 kernel/locking/lockdep.c:1227
[< inline >] check_prev_add kernel/locking/lockdep.c:1867
[< inline >] check_prevs_add kernel/locking/lockdep.c:1980
[< inline >] validate_chain kernel/locking/lockdep.c:2421
[< none >] __lock_acquire+0x12ab/0x1350 kernel/locking/lockdep.c:3435
?[< inline >] check_irq_usage kernel/locking/lockdep.c:1674
?[< inline >] check_prev_add_irq kernel/locking/lockdep_states.h:8
?[< inline >] check_prev_add kernel/locking/lockdep.c:1872
?[< inline >] check_prevs_add kernel/locking/lockdep.c:1980
?[< inline >] validate_chain kernel/locking/lockdep.c:2421
?[< none >] __lock_acquire+0x1131/0x1350 kernel/locking/lockdep.c:3435
[< none >] lock_acquire+0xa3/0x210 kernel/locking/lockdep.c:3924
?[< none >] lock_acquire+0xa3/0x210 kernel/locking/lockdep.c:3924
?[< none >] btrfs_finish_chunk_alloc+0xe6/0x490 fs/btrfs/volumes.c:4975
?[< none >] btrfs_finish_chunk_alloc+0xe6/0x490 fs/btrfs/volumes.c:4975
[< inline >] __mutex_lock_common kernel/locking/mutex.c:757
[< none >] __mutex_lock+0x7d/0xa60 kernel/locking/mutex.c:894
?[< none >] btrfs_finish_chunk_alloc+0xe6/0x490 fs/btrfs/volumes.c:4975
?[< inline >] kmalloc ./include/linux/slab.h:518
?[< inline >] kzalloc ./include/linux/slab.h:707
?[< none >] btrfs_finish_chunk_alloc+0xb9/0x490 fs/btrfs/volumes.c:4962
?[< none >] __lock_is_held+0x65/0xb0 kernel/locking/lockdep.c:3744
?[< inline >] kmalloc ./include/linux/slab.h:518
?[< inline >] kzalloc ./include/linux/slab.h:707
?[< none >] btrfs_finish_chunk_alloc+0xb9/0x490 fs/btrfs/volumes.c:4962
?[< inline >] kmalloc ./include/linux/slab.h:518
?[< inline >] kzalloc ./include/linux/slab.h:707
?[< none >] btrfs_finish_chunk_alloc+0xb9/0x490 fs/btrfs/volumes.c:4962
[< none >] mutex_lock_nested+0x1b/0x20 kernel/locking/mutex.c:909
?[< none >] mutex_lock_nested+0x1b/0x20 kernel/locking/mutex.c:909
[< none >] btrfs_finish_chunk_alloc+0xe6/0x490 fs/btrfs/volumes.c:4975
?[< inline >] btrfs_free_path fs/btrfs/ctree.c:4870
?[< none >] btrfs_insert_item+0x80/0xf0 fs/btrfs/ctree.c:4876
[< none >] btrfs_create_pending_block_groups+0x13c/0x260 fs/btrfs/extent-tree.c:10209
[< none >] __btrfs_end_transaction+0x91/0x2e0 fs/btrfs/transaction.c:832
[< none >] btrfs_end_transaction+0x10/0x20 fs/btrfs/transaction.c:905
[< none >] btrfs_alloc_data_chunk_ondemand+0xfd/0x4b0 fs/btrfs/extent-tree.c:4294
[< none >] btrfs_check_data_free_space+0x58/0xb0 fs/btrfs/extent-tree.c:4375
[< none >] btrfs_delalloc_reserve_space+0x25/0x70 fs/btrfs/extent-tree.c:6169
[< none >] btrfs_page_mkwrite+0x84/0x540 fs/btrfs/inode.c:8910
[< none >] do_page_mkwrite+0x37/0xd0 mm/memory.c:2380
?[< none >] __do_fault+0x26/0x160 mm/memory.c:3231
[< inline >] do_shared_fault mm/memory.c:3706
[< inline >] do_fault mm/memory.c:3745
[< inline >] handle_pte_fault mm/memory.c:3972
[< none >] __handle_mm_fault+0xcc1/0x1310 mm/memory.c:4096
[< none >] handle_mm_fault+0x1ba/0x3c0 mm/memory.c:4133
[< inline >] faultin_page mm/gup.c:518
[< none >] __get_user_pages+0x1ce/0x720 mm/gup.c:718
[< inline >] __get_user_pages_locked mm/gup.c:889
[< none >] get_user_pages_unlocked+0x143/0x1c0 mm/gup.c:1012
[< none >] get_user_pages_fast+0xad/0x140 mm/gup.c:1863
[< none >] iov_iter_get_pages+0xc3/0x2f0 lib/iov_iter.c:1198
[< inline >] dio_refill_pages fs/direct-io.c:170
[< inline >] dio_get_page fs/direct-io.c:214
[< inline >] do_direct_IO fs/direct-io.c:980
[< none >] do_blockdev_direct_IO+0x1ba2/0x2b50 fs/direct-io.c:1331
?[< none >] kvm_clock_read+0x23/0x40 arch/x86/kernel/kvmclock.c:89
?[< none >] kvm_sched_clock_read+0x9/0x20 arch/x86/kernel/kvmclock.c:101
?[< none >] can_nocow_extent+0x4a0/0x4a0 fs/btrfs/btrfs_inode.h:233
?[< none >] can_nocow_extent+0x4a0/0x4a0 fs/btrfs/btrfs_inode.h:233
?[< none >] btrfs_merge_bio_hook+0xb0/0xb0 fs/btrfs/inode.c:1936
[< none >] __blockdev_direct_IO+0x2e/0x30 fs/direct-io.c:1417
?[< none >] __blockdev_direct_IO+0x2e/0x30 fs/direct-io.c:1417
?[< none >] btrfs_merge_bio_hook+0xb0/0xb0 fs/btrfs/inode.c:1936
[< none >] btrfs_direct_IO+0x16b/0x410 fs/btrfs/inode.c:8629
?[< none >] btrfs_merge_bio_hook+0xb0/0xb0 fs/btrfs/inode.c:1936
[< none >] generic_file_read_iter+0xce/0xda0 mm/filemap.c:2341
?[< none >] __might_sleep+0x4a/0x80 kernel/sched/core.c:6140
[< inline >] call_read_iter ./include/linux/fs.h:1787
[< inline >] new_sync_read fs/read_write.c:406
[< none >] __vfs_read+0x109/0x180 fs/read_write.c:418
[< none >] vfs_read+0xa3/0x150 fs/read_write.c:452
[< none >] ksys_pread64+0x79/0x90 fs/read_write.c:626
[< inline >] __do_sys_pread64 fs/read_write.c:636
[< inline >] __se_sys_pread64 fs/read_write.c:633
[< none >] __x64_sys_pread64+0x1e/0x20 fs/read_write.c:633
[< none >] do_syscall_64+0x65/0x220 arch/x86/entry/common.c:290
[< none >] entry_SYSCALL_64_after_hwframe+0x49/0xbe /home/rzwisler/project/linux/arch/x86/entry/entry_64.S:238
RIP: 0033:0x7febfea07873
Code: 49 89 ca b8 11 00 00 00 0f 05 48 3d 01 f0 ff ff 73 34 c3 48 83 ec 08 e8 ab f1 ff ff 48 89 04 24 49 89 ca b8 11 00 00 00 0f 05 <48> 8b 3c 24 48 89 c2 e8 f1 f1 ff ff 48 89 d0 48 83 c4 08 48 3d 01
RSP: 002b:00007febfe02aed0 EFLAGS: 00000293 ORIG_RAX: 0000000000000011
RAX: ffffffffffffffda RBX: 0000000000000000 RCX: 00007febfea07873
RDX: 0000000000004000 RSI: 00007febff447000 RDI: 0000000000000004
RBP: 0000000000004000 R08: 00007febfe3dc1b8 R09: 00007febfe3dc220
R10: 0000000000000000 R11: 0000000000000293 R12: 00007ffd0d59866e
R13: 00007ffd0d59866f R14: 0000000000000000 R15: 00007ffd0d598670
BTRFS info (device pmem0p1): disk space caching is enabled
BTRFS info (device pmem0p1): has skinny extents
BTRFS info (device pmem0p1): enabling ssd optimizations
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: Lockdep splat with v4.18.6
2018-07-26 22:09 Lockdep splat with v4.18.6 Ross Zwisler
@ 2018-07-27 0:15 ` Anand Jain
0 siblings, 0 replies; 2+ messages in thread
From: Anand Jain @ 2018-07-27 0:15 UTC (permalink / raw)
To: Ross Zwisler, Chris Mason, Josef Bacik, David Sterba, linux-btrfs,
Ross Zwisler
Hi Ross,
Thanks for the report. I have analyzed it here [1] earlier and is
harmless since lockdep checks doesn't seem to account for the
difference in the lock time-space, there is similar fix in block
layer as well (which I am unable to pull the ref as of now, but
will try again). And this happened after we have added [2]
[1]
https://www.spinics.net/lists/linux-btrfs/msg79708.html
[2]
542c5908abfe84f7
btrfs: replace uuid_mutex by device_list_mutex in btrfs_open_devices
I am consolidating the locks in parts, will be fixed.
Thanks, Anand
On 07/27/2018 06:09 AM, Ross Zwisler wrote:
> I was testing my new xfstest posted here:
>
> https://lists.01.org/pipermail/linux-nvdimm/2018-July/016850.html
>
> against a btrfs test device + scrach device setup, and hit a lockdep
> splat. I'm using vanilla v4.18.6.
>
> I've attached the splats to this mail, one just as it happened in
> dmesg and one passed through kasan_symbolize.py for files, line
> numbers, etc.
>
> Thanks,
> - Ross
>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2018-07-27 1:31 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-07-26 22:09 Lockdep splat with v4.18.6 Ross Zwisler
2018-07-27 0:15 ` 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).