Re: [syzbot] [ext4?] possible deadlock in jbd2_log_wait_commit

From: Jan Kara
Date: Wed Mar 01 2023 - 07:43:42 EST


On Wed 01-03-23 02:08:19, syzbot wrote:
> syzbot has bisected this issue to:
>
> commit 0813299c586b175d7edb25f56412c54b812d0379
> Author: Jan Kara <jack@xxxxxxx>
> Date: Thu Jan 26 11:22:21 2023 +0000
>
> ext4: Fix possible corruption when moving a directory
>
> bisection log: https://syzkaller.appspot.com/x/bisect.txt?x=14845d50c80000
> start commit: e492250d5252 Merge tag 'pwm/for-6.3-rc1' of git://git.kern..
> git tree: upstream
> final oops: https://syzkaller.appspot.com/x/report.txt?x=16845d50c80000
> console output: https://syzkaller.appspot.com/x/log.txt?x=12845d50c80000
> kernel config: https://syzkaller.appspot.com/x/.config?x=f763d89e26d3d4c4
> dashboard link: https://syzkaller.appspot.com/bug?extid=9d16c39efb5fade84574
> syz repro: https://syzkaller.appspot.com/x/repro.syz?x=11d96208c80000
> C reproducer: https://syzkaller.appspot.com/x/repro.c?x=176d917f480000
>
> Reported-by: syzbot+9d16c39efb5fade84574@xxxxxxxxxxxxxxxxxxxxxxxxx
> Fixes: 0813299c586b ("ext4: Fix possible corruption when moving a directory")
>
> For information about bisection process see: https://goo.gl/tpsmEJ#bisection

Drat, yeah, lockdep is actually right. We should not be grabbing i_rwsem
while having transaction started in ext4_rename(). I'm somewhat surprised
we didn't hit this lockdep warning earlier during the testing. So we need
to move the locking earlier in ext4_rename(). I'll send a patch...

Honza

--
Jan Kara <jack@xxxxxxxx>
SUSE Labs, CR