hfs: request for non-existent node 65538 in B*Tree
hfs: request for non-existent node 65538 in B*Tree
hfs: fail to find leaf node: node ID 65538
============================================
WARNING: possible recursive locking detected
syzkaller #0 Not tainted
--------------------------------------------
syz.3.54/6157 is trying to acquire lock:
ffff888114f242a0 (&HFS_I(tree->inode)->extents_lock){+.+.}-{4:4}, at: hfs_extend_file+0xf9/0x1680

but task is already holding lock:
ffff888114f23ca0 (&HFS_I(tree->inode)->extents_lock){+.+.}-{4:4}, at: hfs_extend_file+0xf9/0x1680

other info that might help us debug this:
 Possible unsafe locking scenario:

       CPU0
       ----
  lock(&HFS_I(tree->inode)->extents_lock);
  lock(&HFS_I(tree->inode)->extents_lock);

 *** DEADLOCK ***

 May be due to missing lock nesting notation

locks held by syz.3.54/6157: 5, last CPU#0:
 #0: ffff8881134aa460 (sb_writers#24){.+.+}-{0:0}, at: mnt_want_write+0x41/0x90
 #1: ffff888114f23840 (&type->i_mutex_dir_key#16/1){+.+.}-{4:4}, at: filename_create+0x200/0x370
 #2: ffff8881763560a8 (&tree->tree_lock#2){+.+.}-{4:4}, at: hfs_find_init+0x18d/0x300
 #3: ffff888114f23ca0 (&HFS_I(tree->inode)->extents_lock){+.+.}-{4:4}, at: hfs_extend_file+0xf9/0x1680
 #4: ffff88816c0ec0a8 (&tree->tree_lock#2/1){+.+.}-{4:4}, at: hfs_find_init+0x18d/0x300

stack backtrace:
CPU: 0 UID: 0 PID: 6157 Comm: syz.3.54 Not tainted syzkaller #0 PREEMPT(full) 
Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.16.2-debian-1.16.2-1 04/01/2014
Call Trace:
 <TASK>
 dump_stack_lvl+0xe8/0x150
 print_deadlock_bug+0x27a/0x290
 __lock_acquire+0x25db/0x2de0
 lock_acquire+0x115/0x350
 __mutex_lock+0x197/0x15a0
 hfs_extend_file+0xf9/0x1680
 hfs_bmap_reserve+0x108/0x430
 __hfs_ext_write_extent+0x1fc/0x470
 __hfs_ext_cache_extent+0x6e/0x9b0
 hfs_extend_file+0x3ad/0x1680
 hfs_bmap_reserve+0x108/0x430
 hfs_cat_create+0x23d/0x870
 hfs_mkdir+0x73/0xe0
 vfs_mkdir+0x40e/0x630
 filename_mkdirat+0x285/0x510
 __se_sys_mkdirat+0x35/0x150
 do_syscall_64+0x166/0x520
 entry_SYSCALL_64_after_hwframe+0x77/0x7f
RIP: 0033:0x7f36be59d047
Code: 00 66 90 48 89 f2 b9 00 01 00 00 48 89 fe bf 9c ff ff ff e9 db f7 ff ff 66 2e 0f 1f 84 00 00 00 00 00 90 b8 02 01 00 00 0f 05 <48> 3d 01 f0 ff ff 73 01 c3 48 c7 c1 e8 ff ff ff f7 d8 64 89 01 48
RSP: 002b:00007f36bf45de58 EFLAGS: 00000246 ORIG_RAX: 0000000000000102
RAX: ffffffffffffffda RBX: 00007f36bf45dee0 RCX: 00007f36be59d047
RDX: 00000000000001ff RSI: 0000200000000280 RDI: 00000000ffffff9c
RBP: 00002000000002c0 R08: 0000200000000280 R09: 0000000000000000
R10: 00002000000002c0 R11: 0000000000000246 R12: 0000200000000280
R13: 00007f36bf45dea0 R14: 0000000000000000 R15: 0000000000000000
 </TASK>
hfs: new node 0 already hashed?
------------[ cut here ]------------
1
WARNING: fs/hfs/bnode.c:478 at hfs_bnode_create+0x45a/0x4e0, CPU#0: syz.3.54/6157
Modules linked in:
CPU: 0 UID: 0 PID: 6157 Comm: syz.3.54 Not tainted syzkaller #0 PREEMPT(full) 
Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.16.2-debian-1.16.2-1 04/01/2014
RIP: 0010:hfs_bnode_create+0x45a/0x4e0
Code: 2a 8c 89 ee e8 87 60 68 fe e9 d6 fc ff ff e8 fd 3d 09 ff 4c 89 ef e8 55 64 32 09 48 c7 c7 40 6b 2a 8c 89 ee e8 67 60 68 fe 90 <0f> 0b 90 eb b0 44 89 f1 80 e1 07 80 c1 03 38 c1 0f 8c dd fb ff ff
RSP: 0000:ffffc90003887548 EFLAGS: 00010246
RAX: 000000000000001f RBX: ffff88816c0ec000 RCX: 38a34c5c5900ff00
RDX: 0000000000000000 RSI: 0000000000000000 RDI: ffffffff8fc33da0
RBP: 0000000000000000 R08: ffffc900038872a7 R09: 1ffff92000710e54
R10: dffffc0000000000 R11: fffff52000710e55 R12: 0000000000000000
R13: ffff88816c0ec0d8 R14: ffff888174f66300 R15: dffffc0000000000
FS:  00007f36bf45e6c0(0000) GS:ffff88818c4ad000(0000) knlGS:0000000000000000
CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 0000001b31dfaff8 CR3: 000000011031e000 CR4: 00000000000006f0
Call Trace:
 <TASK>
 hfs_btree_inc_height+0xf9/0xac0
 hfs_brec_insert+0x7eb/0xc80
 __hfs_ext_write_extent+0x2a3/0x470
 __hfs_ext_cache_extent+0x6e/0x9b0
 hfs_extend_file+0x3ad/0x1680
 hfs_bmap_reserve+0x108/0x430
 hfs_cat_create+0x23d/0x870
 hfs_mkdir+0x73/0xe0
 vfs_mkdir+0x40e/0x630
 filename_mkdirat+0x285/0x510
 __se_sys_mkdirat+0x35/0x150
 do_syscall_64+0x166/0x520
 entry_SYSCALL_64_after_hwframe+0x77/0x7f
RIP: 0033:0x7f36be59d047
Code: 00 66 90 48 89 f2 b9 00 01 00 00 48 89 fe bf 9c ff ff ff e9 db f7 ff ff 66 2e 0f 1f 84 00 00 00 00 00 90 b8 02 01 00 00 0f 05 <48> 3d 01 f0 ff ff 73 01 c3 48 c7 c1 e8 ff ff ff f7 d8 64 89 01 48
RSP: 002b:00007f36bf45de58 EFLAGS: 00000246 ORIG_RAX: 0000000000000102
RAX: ffffffffffffffda RBX: 00007f36bf45dee0 RCX: 00007f36be59d047
RDX: 00000000000001ff RSI: 0000200000000280 RDI: 00000000ffffff9c
RBP: 00002000000002c0 R08: 0000200000000280 R09: 0000000000000000
R10: 00002000000002c0 R11: 0000000000000246 R12: 0000200000000280
R13: 00007f36bf45dea0 R14: 0000000000000000 R15: 0000000000000000
 </TASK>
