loop0: detected capacity change from 0 to 64
============================================
WARNING: possible recursive locking detected
syzkaller #0 Not tainted
--------------------------------------------
syz.0.510/9454 is trying to acquire lock:
ffff88816f8600f8 (&HFS_I(tree->inode)->extents_lock){+.+.}-{4:4}, at: hfs_extend_file+0xf2/0x15e0

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

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

5 locks held by syz.0.510/9454:
 #0: ffff88816d7fe420 (sb_writers#29){.+.+}-{0:0}, at: mnt_want_write+0x41/0x90
 #1: ffff88816f860fa0 (&type->i_mutex_dir_key#21/1){+.+.}-{4:4}, at: filename_create+0x200/0x370
 #2: ffff8881bc3020b0 (&tree->tree_lock#2){+.+.}-{4:4}, at: hfs_find_init+0x18e/0x300
 #3: ffff88816f860778 (&HFS_I(tree->inode)->extents_lock){+.+.}-{4:4}, at: hfs_extend_file+0xf2/0x15e0
 #4: ffff888176aec0b0 (&tree->tree_lock#2/1){+.+.}-{4:4}, at: hfs_find_init+0x18e/0x300

stack backtrace:
CPU: 1 UID: 0 PID: 9454 Comm: syz.0.510 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+0x279/0x290
 __lock_acquire+0x253f/0x2cf0
 lock_acquire+0x106/0x330
 __mutex_lock+0x19f/0x1340
 hfs_extend_file+0xf2/0x15e0
 hfs_bmap_reserve+0x107/0x430
 __hfs_ext_write_extent+0x1fa/0x470
 __hfs_ext_cache_extent+0x6b/0x9b0
 hfs_extend_file+0x39b/0x15e0
 hfs_bmap_reserve+0x107/0x430
 hfs_cat_create+0x20f/0x800
 hfs_create+0x66/0xe0
 vfs_create+0x3a9/0x400
 do_mknodat+0x3f1/0x620
 __x64_sys_mknod+0x8c/0xa0
 do_syscall_64+0xe2/0xf80
 entry_SYSCALL_64_after_hwframe+0x77/0x7f
RIP: 0033:0x7fcf9579acb9
Code: ff c3 66 2e 0f 1f 84 00 00 00 00 00 0f 1f 44 00 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 e8 ff ff ff f7 d8 64 89 01 48
RSP: 002b:00007fcf96689028 EFLAGS: 00000246 ORIG_RAX: 0000000000000085
RAX: ffffffffffffffda RBX: 00007fcf95a15fa0 RCX: 00007fcf9579acb9
RDX: 0000000000000701 RSI: 0000000000000800 RDI: 0000200000000500
RBP: 00007fcf95808bf7 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000
R13: 00007fcf95a16038 R14: 00007fcf95a15fa0 R15: 00007fffdd25cef8
 </TASK>
hfs: new node 0 already hashed?
------------[ cut here ]------------
WARNING: fs/hfs/bnode.c:520 at hfs_bnode_create+0x461/0x4f0, CPU#1: syz.0.510/9454
Modules linked in:
CPU: 1 UID: 0 PID: 9454 Comm: syz.0.510 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+0x461/0x4f0
Code: a2 8b 89 ee e8 c0 be 82 fe e9 cf fc ff ff e8 26 9c 1d ff 4c 89 ef e8 ee 3d d3 08 48 c7 c7 80 b9 a2 8b 89 ee e8 a0 be 82 fe 90 <0f> 0b 90 eb b0 44 89 f1 80 e1 07 80 c1 03 38 c1 0f 8c d6 fb ff ff
RSP: 0018:ffffc900037f7480 EFLAGS: 00010246
RAX: 000000000000001f RBX: ffff888176aec000 RCX: b33e601fb8e79b00
RDX: ffffc90009f71000 RSI: 000000000001ad1c RDI: 000000000001ad1d
RBP: 0000000000000000 R08: ffffc900037f7207 R09: 1ffff920006fee40
R10: dffffc0000000000 R11: fffff520006fee41 R12: 0000000000000000
R13: ffff888176aec0e0 R14: ffff888161297d00 R15: dffffc0000000000
FS:  00007fcf966896c0(0000) GS:ffff8882a9a0b000(0000) knlGS:0000000000000000
CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 00005597c3a6b131 CR3: 000000011b77e000 CR4: 00000000000006f0
Call Trace:
 <TASK>
 hfs_bmap_alloc+0x5c1/0x650
 hfs_btree_inc_height+0x100/0xad0
 hfs_brec_insert+0x7ef/0xc90
 __hfs_ext_write_extent+0x2a1/0x470
 __hfs_ext_cache_extent+0x6b/0x9b0
 hfs_extend_file+0x39b/0x15e0
 hfs_bmap_reserve+0x107/0x430
 hfs_cat_create+0x20f/0x800
 hfs_create+0x66/0xe0
 vfs_create+0x3a9/0x400
 do_mknodat+0x3f1/0x620
 __x64_sys_mknod+0x8c/0xa0
 do_syscall_64+0xe2/0xf80
 entry_SYSCALL_64_after_hwframe+0x77/0x7f
RIP: 0033:0x7fcf9579acb9
Code: ff c3 66 2e 0f 1f 84 00 00 00 00 00 0f 1f 44 00 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 e8 ff ff ff f7 d8 64 89 01 48
RSP: 002b:00007fcf96689028 EFLAGS: 00000246 ORIG_RAX: 0000000000000085
RAX: ffffffffffffffda RBX: 00007fcf95a15fa0 RCX: 00007fcf9579acb9
RDX: 0000000000000701 RSI: 0000000000000800 RDI: 0000200000000500
RBP: 00007fcf95808bf7 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000
R13: 00007fcf95a16038 R14: 00007fcf95a15fa0 R15: 00007fffdd25cef8
 </TASK>
