======================================================
WARNING: possible circular locking dependency detected
syzkaller #0 Not tainted
------------------------------------------------------
syz.7.1591/13648 is trying to acquire lock:
ffff88801f0e00c8 (&ei->xattr_sem){++++}-{4:4}, at: ext4_destroy_inline_data+0x28/0xe0

but task is already holding lock:
ffff8881b5cceb98 (&sbi->s_writepages_rwsem){++++}-{0:0}, at: ext4_writepages+0x1cc/0x350

which lock already depends on the new lock.


the existing dependency chain (in reverse order) is:

-> #1 (&sbi->s_writepages_rwsem){++++}-{0:0}:
       lock_acquire+0x120/0x360
       percpu_down_read_internal+0x48/0x1c0
       ext4_writepages+0x1cc/0x350
       do_writepages+0x32e/0x550
       __writeback_single_inode+0x145/0xff0
       writeback_single_inode+0x1f9/0x6a0
       write_inode_now+0x160/0x1d0
       iput+0x830/0xc50
       ext4_xattr_block_set+0x1fce/0x2ac0
       ext4_expand_extra_isize_ea+0x12da/0x1ea0
       __ext4_expand_extra_isize+0x30d/0x400
       __ext4_mark_inode_dirty+0x46c/0x700
       ext4_evict_inode+0x80d/0xee0
       evict+0x504/0x9c0
       ext4_orphan_cleanup+0xc20/0x1460
       ext4_fill_super+0x5920/0x61e0
       get_tree_bdev_flags+0x40e/0x4d0
       vfs_get_tree+0x92/0x2b0
       do_new_mount+0x302/0xa10
       __se_sys_mount+0x313/0x410
       do_syscall_64+0xfa/0xfa0
       entry_SYSCALL_64_after_hwframe+0x77/0x7f

-> #0 (&ei->xattr_sem){++++}-{4:4}:
       validate_chain+0xb9b/0x2140
       __lock_acquire+0xab9/0xd20
       lock_acquire+0x120/0x360
       down_write+0x96/0x1f0
       ext4_destroy_inline_data+0x28/0xe0
       ext4_do_writepages+0x526/0x4610
       ext4_writepages+0x205/0x350
       do_writepages+0x32e/0x550
       filemap_flush+0x191/0x230
       ext4_release_file+0x82/0x310
       __fput+0x44c/0xa70
       task_work_run+0x1d4/0x260
       do_exit+0x6b5/0x2300
       do_group_exit+0x21c/0x2d0
       get_signal+0x1285/0x1340
       arch_do_signal_or_restart+0xa0/0x790
       irqentry_exit_to_user_mode+0x7e/0x110
       exc_page_fault+0xab/0x100
       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 ***

1 lock held by syz.7.1591/13648:
 #0: ffff8881b5cceb98 (&sbi->s_writepages_rwsem){++++}-{0:0}, at: ext4_writepages+0x1cc/0x350

stack backtrace:
CPU: 1 UID: 0 PID: 13648 Comm: syz.7.1591 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+0x189/0x250
 print_circular_bug+0x2ee/0x310
 check_noncircular+0x134/0x160
 validate_chain+0xb9b/0x2140
 __lock_acquire+0xab9/0xd20
 lock_acquire+0x120/0x360
 down_write+0x96/0x1f0
 ext4_destroy_inline_data+0x28/0xe0
 ext4_do_writepages+0x526/0x4610
 ext4_writepages+0x205/0x350
 do_writepages+0x32e/0x550
 filemap_flush+0x191/0x230
 ext4_release_file+0x82/0x310
 __fput+0x44c/0xa70
 task_work_run+0x1d4/0x260
 do_exit+0x6b5/0x2300
 do_group_exit+0x21c/0x2d0
 get_signal+0x1285/0x1340
 arch_do_signal_or_restart+0xa0/0x790
 irqentry_exit_to_user_mode+0x7e/0x110
 exc_page_fault+0xab/0x100
 asm_exc_page_fault+0x26/0x30
RIP: 0033:0x7fdaeaf8f7d1
Code: Unable to access opcode bytes at 0x7fdaeaf8f7a7.
RSP: 002b:fffffffffffffe70 EFLAGS: 00010217
RAX: 0000000000000000 RBX: 00007fdaeb1e6090 RCX: 00007fdaeaf8f7c9
RDX: 0000000000000000 RSI: fffffffffffffe70 RDI: 0000000000008000
RBP: 00007fdaeaff297f R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000206 R12: 0000000000000000
R13: 00007fdaeb1e6128 R14: 00007fdaeb1e6090 R15: 00007ffdaec51fb8
 </TASK>
EXT4-fs error (device loop7): ext4_validate_block_bitmap:432: comm syz.7.1591: bg 0: block 5: invalid block bitmap
EXT4-fs (loop7): Delayed block allocation failed for inode 18 at logical offset 0 with max blocks 5 with error 28
EXT4-fs (loop7): This should not happen!! Data will be lost

EXT4-fs (loop7): Total free blocks count 0
EXT4-fs (loop7): Free/Dirty block details
EXT4-fs (loop7): free_blocks=0
EXT4-fs (loop7): dirty_blocks=9358
EXT4-fs (loop7): Block reservation details
EXT4-fs (loop7): i_reserved_data_blocks=9357
