loop6: detected capacity change from 0 to 512
======================================================
WARNING: possible circular locking dependency detected
syzkaller #0 Tainted: G             L     
------------------------------------------------------
syz.6.13180/7335 is trying to acquire lock:
ffff888023422c18 (&sbi->s_writepages_rwsem){++++}-{0:0}, at: ext4_writepages+0x205/0x3b0

but task is already holding lock:
ffff8881181a5e80 (&ei->xattr_sem){++++}-{4:4}, at: __ext4_mark_inode_dirty+0x3d0/0x700

which lock already depends on the new lock.


the existing dependency chain (in reverse order) is:

-> #1 (&ei->xattr_sem){++++}-{4:4}:
       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

-> #0 (&sbi->s_writepages_rwsem){++++}-{0:0}:
       __lock_acquire+0x1520/0x2cf0
       lock_acquire+0x106/0x350
       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

other info that might help us debug this:

 Possible unsafe locking scenario:

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

 *** DEADLOCK ***

3 locks held by syz.6.13180/7335:
 #0: ffff8880234240d8 (&type->s_umount_key#28/1){+.+.}-{4:4}, at: sget_fc+0x938/0x1900
 #1: ffff888023424640 (sb_internal){.+.+}-{0:0}, at: ext4_evict_inode+0x426/0x10c0
 #2: ffff8881181a5e80 (&ei->xattr_sem){++++}-{4:4}, at: __ext4_mark_inode_dirty+0x3d0/0x700

stack backtrace:
CPU: 0 UID: 0 PID: 7335 Comm: syz.6.13180 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
 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
RIP: 0033:0x7f27cb79e0ca
Code: 48 c7 c2 e8 ff ff ff f7 d8 64 89 02 b8 ff ff ff ff c3 66 2e 0f 1f 84 00 00 00 00 00 0f 1f 40 00 49 89 ca b8 a5 00 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:00007f27cc6f6e58 EFLAGS: 00000246 ORIG_RAX: 00000000000000a5
RAX: ffffffffffffffda RBX: 00007f27cc6f6ee0 RCX: 00007f27cb79e0ca
RDX: 0000200000000180 RSI: 0000200000000000 RDI: 00007f27cc6f6ea0
RBP: 0000200000000180 R08: 00007f27cc6f6ee0 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000246 R12: 0000200000000000
R13: 00007f27cc6f6ea0 R14: 000000000000047a R15: 000000000000002c
 </TASK>
EXT4-fs error (device loop6): ext4_xattr_inode_iget:441: inode #11: comm syz.6.13180: iget: bad extra_isize 90 (inode size 256)
loop6: lost file I/O error report for ino 11 type 5 pos 0x0 len 0x0 error -117
EXT4-fs (loop6): Remounting filesystem read-only
EXT4-fs warning (device loop6): ext4_expand_extra_isize_ea:2860: Unable to expand inode 15. Delete some EAs or run e2fsck.
EXT4-fs warning (device loop6): ext4_evict_inode:270: couldn't mark inode dirty (err -30)
EXT4-fs (loop6): 1 orphan inode deleted
EXT4-fs (loop6): mounted filesystem 00000000-0000-0000-0000-000000000000 r/w without journal. Quota mode: none.
