NILFS (loop2): bad btree node (ino=16, blocknr=15): level = 0, flags = 0x0, nchildren = 0 NILFS error (device loop2): nilfs_bmap_lookup_contig: broken bmap (inode number=16) ====================================================== WARNING: possible circular locking dependency detected 6.1.0-rc3-syzkaller-00152-gf2f32f8af2b0 #0 Not tainted ------------------------------------------------------ syz-executor.2/19026 is trying to acquire lock: ffff88807a7bb090 (&nilfs->ns_sem){++++}-{3:3}, at: nilfs_set_error fs/nilfs2/super.c:92 [inline] ffff88807a7bb090 (&nilfs->ns_sem){++++}-{3:3}, at: __nilfs_error+0x195/0x401 fs/nilfs2/super.c:137 but task is already holding lock: ffff88802a29cc70 (&dat_lock_key){.+.+}-{3:3}, at: nilfs_get_block+0x1af/0xa50 fs/nilfs2/inode.c:84 which lock already depends on the new lock. the existing dependency chain (in reverse order) is: -> #1 (&dat_lock_key){.+.+}-{3:3}: down_read+0x98/0x450 kernel/locking/rwsem.c:1509 nilfs_count_free_blocks+0x68/0x180 fs/nilfs2/the_nilfs.c:693 nilfs_set_log_cursor fs/nilfs2/super.c:236 [inline] nilfs_cleanup_super+0x133/0x490 fs/nilfs2/super.c:318 nilfs_put_super+0x152/0x1a0 fs/nilfs2/super.c:472 generic_shutdown_super+0x154/0x410 fs/super.c:492 kill_block_super+0x97/0xf0 fs/super.c:1428 deactivate_locked_super+0x94/0x160 fs/super.c:332 deactivate_super+0xad/0xd0 fs/super.c:363 cleanup_mnt+0x2ae/0x3d0 fs/namespace.c:1186 task_work_run+0x16b/0x270 kernel/task_work.c:179 resume_user_mode_work include/linux/resume_user_mode.h:49 [inline] exit_to_user_mode_loop kernel/entry/common.c:171 [inline] exit_to_user_mode_prepare+0x23c/0x250 kernel/entry/common.c:203 __syscall_exit_to_user_mode_work kernel/entry/common.c:285 [inline] syscall_exit_to_user_mode+0x19/0x50 kernel/entry/common.c:296 do_syscall_64+0x42/0xb0 arch/x86/entry/common.c:86 entry_SYSCALL_64_after_hwframe+0x63/0xcd -> #0 (&nilfs->ns_sem){++++}-{3:3}: check_prev_add kernel/locking/lockdep.c:3097 [inline] check_prevs_add kernel/locking/lockdep.c:3216 [inline] validate_chain kernel/locking/lockdep.c:3831 [inline] __lock_acquire+0x2a43/0x56d0 kernel/locking/lockdep.c:5055 lock_acquire kernel/locking/lockdep.c:5668 [inline] lock_acquire+0x1df/0x630 kernel/locking/lockdep.c:5633 down_write+0x90/0x220 kernel/locking/rwsem.c:1562 nilfs_set_error fs/nilfs2/super.c:92 [inline] __nilfs_error+0x195/0x401 fs/nilfs2/super.c:137 nilfs_bmap_convert_error fs/nilfs2/bmap.c:35 [inline] nilfs_bmap_lookup_contig+0x13d/0x180 fs/nilfs2/bmap.c:95 nilfs_get_block+0x1ee/0xa50 fs/nilfs2/inode.c:85 do_mpage_readpage+0x765/0x19e0 fs/mpage.c:208 mpage_readahead+0x349/0x580 fs/mpage.c:361 read_pages+0x1a2/0xd60 mm/readahead.c:161 page_cache_ra_unbounded+0x473/0x5e0 mm/readahead.c:270 do_page_cache_ra mm/readahead.c:300 [inline] page_cache_ra_order+0x6e8/0xa00 mm/readahead.c:560 ondemand_readahead+0x6b3/0x1000 mm/readahead.c:682 page_cache_sync_ra+0x1c5/0x200 mm/readahead.c:709 page_cache_sync_readahead include/linux/pagemap.h:1213 [inline] filemap_get_pages+0x2ca/0x16b0 mm/filemap.c:2581 filemap_read+0x311/0xc00 mm/filemap.c:2675 generic_file_read_iter+0x3b0/0x5a0 mm/filemap.c:2821 __kernel_read+0x2c6/0x7c0 fs/read_write.c:428 integrity_kernel_read+0x7b/0xb0 security/integrity/iint.c:199 ima_calc_file_hash_tfm+0x2aa/0x3b0 security/integrity/ima/ima_crypto.c:485 ima_calc_file_shash security/integrity/ima/ima_crypto.c:516 [inline] ima_calc_file_hash+0x191/0x4a0 security/integrity/ima/ima_crypto.c:573 ima_collect_measurement+0x63e/0x7a0 security/integrity/ima/ima_api.c:292 process_measurement+0xd1e/0x18b0 security/integrity/ima/ima_main.c:337 ima_file_check+0xac/0x100 security/integrity/ima/ima_main.c:517 do_open fs/namei.c:3559 [inline] path_openat+0x1611/0x2860 fs/namei.c:3713 do_filp_open+0x1b6/0x400 fs/namei.c:3740 do_sys_openat2+0x16d/0x4c0 fs/open.c:1310 do_sys_open fs/open.c:1326 [inline] __do_sys_open fs/open.c:1334 [inline] __se_sys_open fs/open.c:1330 [inline] __x64_sys_open+0x119/0x1c0 fs/open.c:1330 do_syscall_x64 arch/x86/entry/common.c:50 [inline] do_syscall_64+0x35/0xb0 arch/x86/entry/common.c:80 entry_SYSCALL_64_after_hwframe+0x63/0xcd other info that might help us debug this: Possible unsafe locking scenario: CPU0 CPU1 ---- ---- lock(&dat_lock_key); lock(&nilfs->ns_sem); lock(&dat_lock_key); lock(&nilfs->ns_sem); *** DEADLOCK *** 3 locks held by syz-executor.2/19026: #0: ffff88801c8cd980 (&iint->mutex){+.+.}-{3:3}, at: process_measurement+0x3b9/0x18b0 security/integrity/ima/ima_main.c:260 #1: ffff888029880cf0 (mapping.invalidate_lock#6){.+.+}-{3:3}, at: filemap_invalidate_lock_shared include/linux/fs.h:811 [inline] #1: ffff888029880cf0 (mapping.invalidate_lock#6){.+.+}-{3:3}, at: page_cache_ra_unbounded+0x14f/0x5e0 mm/readahead.c:226 #2: ffff88802a29cc70 (&dat_lock_key){.+.+}-{3:3}, at: nilfs_get_block+0x1af/0xa50 fs/nilfs2/inode.c:84 stack backtrace: CPU: 1 PID: 19026 Comm: syz-executor.2 Not tainted 6.1.0-rc3-syzkaller-00152-gf2f32f8af2b0 #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 10/11/2022 Call Trace: __dump_stack lib/dump_stack.c:88 [inline] dump_stack_lvl+0xcd/0x134 lib/dump_stack.c:106 check_noncircular+0x25f/0x2e0 kernel/locking/lockdep.c:2177 check_prev_add kernel/locking/lockdep.c:3097 [inline] check_prevs_add kernel/locking/lockdep.c:3216 [inline] validate_chain kernel/locking/lockdep.c:3831 [inline] __lock_acquire+0x2a43/0x56d0 kernel/locking/lockdep.c:5055 lock_acquire kernel/locking/lockdep.c:5668 [inline] lock_acquire+0x1df/0x630 kernel/locking/lockdep.c:5633 down_write+0x90/0x220 kernel/locking/rwsem.c:1562 nilfs_set_error fs/nilfs2/super.c:92 [inline] __nilfs_error+0x195/0x401 fs/nilfs2/super.c:137 nilfs_bmap_convert_error fs/nilfs2/bmap.c:35 [inline] nilfs_bmap_lookup_contig+0x13d/0x180 fs/nilfs2/bmap.c:95 nilfs_get_block+0x1ee/0xa50 fs/nilfs2/inode.c:85 do_mpage_readpage+0x765/0x19e0 fs/mpage.c:208 mpage_readahead+0x349/0x580 fs/mpage.c:361 read_pages+0x1a2/0xd60 mm/readahead.c:161 page_cache_ra_unbounded+0x473/0x5e0 mm/readahead.c:270 do_page_cache_ra mm/readahead.c:300 [inline] page_cache_ra_order+0x6e8/0xa00 mm/readahead.c:560 ondemand_readahead+0x6b3/0x1000 mm/readahead.c:682 page_cache_sync_ra+0x1c5/0x200 mm/readahead.c:709 page_cache_sync_readahead include/linux/pagemap.h:1213 [inline] filemap_get_pages+0x2ca/0x16b0 mm/filemap.c:2581 filemap_read+0x311/0xc00 mm/filemap.c:2675 generic_file_read_iter+0x3b0/0x5a0 mm/filemap.c:2821 __kernel_read+0x2c6/0x7c0 fs/read_write.c:428 integrity_kernel_read+0x7b/0xb0 security/integrity/iint.c:199 ima_calc_file_hash_tfm+0x2aa/0x3b0 security/integrity/ima/ima_crypto.c:485 ima_calc_file_shash security/integrity/ima/ima_crypto.c:516 [inline] ima_calc_file_hash+0x191/0x4a0 security/integrity/ima/ima_crypto.c:573 ima_collect_measurement+0x63e/0x7a0 security/integrity/ima/ima_api.c:292 process_measurement+0xd1e/0x18b0 security/integrity/ima/ima_main.c:337 ima_file_check+0xac/0x100 security/integrity/ima/ima_main.c:517 do_open fs/namei.c:3559 [inline] path_openat+0x1611/0x2860 fs/namei.c:3713 do_filp_open+0x1b6/0x400 fs/namei.c:3740 do_sys_openat2+0x16d/0x4c0 fs/open.c:1310 do_sys_open fs/open.c:1326 [inline] __do_sys_open fs/open.c:1334 [inline] __se_sys_open fs/open.c:1330 [inline] __x64_sys_open+0x119/0x1c0 fs/open.c:1330 do_syscall_x64 arch/x86/entry/common.c:50 [inline] do_syscall_64+0x35/0xb0 arch/x86/entry/common.c:80 entry_SYSCALL_64_after_hwframe+0x63/0xcd RIP: 0033:0x7fd21688b5a9 Code: ff ff c3 66 2e 0f 1f 84 00 00 00 00 00 0f 1f 40 00 48 89 f8 48 89 f7 48 89 d6 48 89 ca 4d 89 c2 4d 89 c8 4c 8b 4c 24 08 0f 05 <48> 3d 01 f0 ff ff 73 01 c3 48 c7 c1 b8 ff ff ff f7 d8 64 89 01 48 RSP: 002b:00007fd215bff168 EFLAGS: 00000246 ORIG_RAX: 0000000000000002 RAX: ffffffffffffffda RBX: 00007fd2169abf80 RCX: 00007fd21688b5a9 RDX: 0000000000000000 RSI: 0000000000000000 RDI: 0000000020000880 RBP: 00007fd2168e67b0 R08: 0000000000000000 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000 R13: 00007ffd7e12719f R14: 00007fd215bff300 R15: 0000000000022000 Remounting filesystem read-only syz-executor.2 (19026) used greatest stack depth: 21400 bytes left