======================================================
WARNING: possible circular locking dependency detected
syzkaller #0 Tainted: G             L     
------------------------------------------------------
syz.8.31753/16071 is trying to acquire lock:
ffff8881bd66e7e0 (&ei->xattr_sem){++++}-{4:4}, at: ext4_destroy_inline_data+0x28/0xe0

but task is already holding lock:
ffff8881ad378c18 (&sbi->s_writepages_rwsem){++++}-{0:0}, at: ext4_writepages+0x205/0x3b0

which lock already depends on the new lock.


the existing dependency chain (in reverse order) is:

-> #1 (&sbi->s_writepages_rwsem){++++}-{0:0}:
       percpu_down_read_internal+0x48/0x1c0
       ext4_writepages+0x205/0x3b0
       do_writepages+0x338/0x560
       __writeback_single_inode+0x12e/0xf90
       writeback_single_inode+0x4ef/0xe70
       write_inode_now+0x1c2/0x290
       iput+0x98b/0xf00
       ext4_xattr_block_set+0x1b0c/0x2a80
       ext4_expand_extra_isize_ea+0x1342/0x1e70
       __ext4_expand_extra_isize+0x30d/0x400
       __ext4_mark_inode_dirty+0x455/0x700
       ext4_evict_inode+0x976/0x10c0
       evict+0x624/0xb50
       ext4_orphan_cleanup+0xc7a/0x14c0
       ext4_fill_super+0x5cb4/0x65c0
       get_tree_bdev_flags+0x430/0x4f0
       vfs_get_tree+0x92/0x2a0
       do_new_mount+0x319/0xdc0
       __se_sys_mount+0x31d/0x420
       do_syscall_64+0x174/0x580
       entry_SYSCALL_64_after_hwframe+0x77/0x7f

-> #0 (&ei->xattr_sem){++++}-{4:4}:
       __lock_acquire+0x1520/0x2cf0
       lock_acquire+0x106/0x350
       down_write+0x96/0x200
       ext4_destroy_inline_data+0x28/0xe0
       ext4_do_writepages+0x573/0x47a0
       ext4_writepages+0x241/0x3b0
       do_writepages+0x338/0x560
       filemap_flush+0x1e1/0x2e0
       ext4_convert_inline_data+0x189/0x5c0
       ext4_page_mkwrite+0x244/0x1140
       do_page_mkwrite+0x147/0x310
       do_wp_page+0x1973/0x4c70
       handle_mm_fault+0x1490/0x3080
       do_user_addr_fault+0xa4d/0x1340
       exc_page_fault+0x6a/0xc0
       asm_exc_page_fault+0x26/0x30

other info that might help us debug this:

 Possible unsafe locking scenario:

       CPU0                    CPU1
       ----                    ----
  rlock(&sbi->s_writepages_rwsem);
                               lock(&ei->xattr_sem);
                               lock(&sbi->s_writepages_rwsem);
  lock(&ei->xattr_sem);

 *** DEADLOCK ***

4 locks held by syz.8.31753/16071:
 #0: ffff888172ef9e88 (vm_lock){++++}-{0:0}, at: lock_vma_under_rcu+0x1d1/0x500
 #1: ffff8881ad37a548 (sb_pagefaults){++++}-{0:0}, at: ext4_page_mkwrite+0x202/0x1140
 #2: ffff8881bd66ec38 (mapping.invalidate_lock#2){++++}-{4:4}, at: ext4_page_mkwrite+0x237/0x1140
 #3: ffff8881ad378c18 (&sbi->s_writepages_rwsem){++++}-{0:0}, at: ext4_writepages+0x205/0x3b0

stack backtrace:
CPU: 1 UID: 0 PID: 16071 Comm: syz.8.31753 Tainted: G             L      syzkaller #0 PREEMPT(full) 
Tainted: [L]=SOFTLOCKUP
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_circular_bug+0x2e1/0x300
 check_noncircular+0x12e/0x150
 __lock_acquire+0x1520/0x2cf0
 lock_acquire+0x106/0x350
 down_write+0x96/0x200
 ext4_destroy_inline_data+0x28/0xe0
 ext4_do_writepages+0x573/0x47a0
 ext4_writepages+0x241/0x3b0
 do_writepages+0x338/0x560
 filemap_flush+0x1e1/0x2e0
 ext4_convert_inline_data+0x189/0x5c0
 ext4_page_mkwrite+0x244/0x1140
 do_page_mkwrite+0x147/0x310
 do_wp_page+0x1973/0x4c70
 handle_mm_fault+0x1490/0x3080
 do_user_addr_fault+0xa4d/0x1340
 exc_page_fault+0x6a/0xc0
 asm_exc_page_fault+0x26/0x30
RIP: 0033:0x7f2ea62665a2
Code: 30 48 8b 14 24 48 85 d2 74 17 8b 44 24 10 0f c8 89 c0 48 89 44 24 10 48 83 fa 01 0f 85 aa 02 00 00 48 8b 44 24 18 8b 74 24 10 <89> 30 e9 1e fe ff ff 48 8b 44 24 18 8b 10 48 8b 04 24 48 85 c0 0f
RSP: 002b:00007ffe6825fbb0 EFLAGS: 00010246
RAX: 00002000000024c0 RBX: 0000000000000000 RCX: 0000000000000000
RDX: 0000000000000000 RSI: 0000000000000005 RDI: 000055557c8763d8
RBP: 00007ffe6825fcd0 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000000 R12: 0000000000000004
R13: 00007f2ea6615fac R14: 00000000001e43a0 R15: 00007f2ea6615fa0
 </TASK>
EXT4-fs error (device loop8): ext4_mb_generate_buddy:1317: group 0, block bitmap and bg descriptor inconsistent: 0 vs 150994969 free clusters
EXT4-fs (loop8): Delayed block allocation failed for inode 15 at logical offset 0 with max blocks 32 with error 28
EXT4-fs (loop8): This should not happen!! Data will be lost

EXT4-fs (loop8): Total free blocks count 0
EXT4-fs (loop8): Free/Dirty block details
EXT4-fs (loop8): free_blocks=2415919504
EXT4-fs (loop8): dirty_blocks=32
EXT4-fs (loop8): Block reservation details
EXT4-fs (loop8): i_reserved_data_blocks=2
