Commit 3c92792
ext4: Fix deadlock during directory rename
As lockdep properly warns, we should not be locking i_rwsem while having
transactions started as the proper lock ordering used by all directory
handling operations is i_rwsem -> transaction start. Fix the lock
ordering by moving the locking of the directory earlier in
ext4_rename().
Reported-by: syzbot+9d16c39efb5fade84574@syzkaller.appspotmail.com
Fixes: 0813299 ("ext4: Fix possible corruption when moving a directory")
Link: https://syzkaller.appspot.com/bug?extid=9d16c39efb5fade84574
Signed-off-by: Jan Kara <jack@suse.cz>
Link: https://lore.kernel.org/r/20230301141004.15087-1-jack@suse.cz
Signed-off-by: Theodore Ts'o <tytso@mit.edu>1 parent 7fc1f5c commit 3c92792
1 file changed
Lines changed: 17 additions & 9 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3813 | 3813 | | |
3814 | 3814 | | |
3815 | 3815 | | |
| 3816 | + | |
| 3817 | + | |
| 3818 | + | |
| 3819 | + | |
| 3820 | + | |
| 3821 | + | |
| 3822 | + | |
3816 | 3823 | | |
3817 | 3824 | | |
3818 | | - | |
3819 | | - | |
| 3825 | + | |
| 3826 | + | |
| 3827 | + | |
| 3828 | + | |
| 3829 | + | |
3820 | 3830 | | |
3821 | 3831 | | |
3822 | 3832 | | |
| |||
3873 | 3883 | | |
3874 | 3884 | | |
3875 | 3885 | | |
3876 | | - | |
3877 | | - | |
3878 | | - | |
3879 | | - | |
3880 | | - | |
3881 | 3886 | | |
3882 | 3887 | | |
3883 | 3888 | | |
| |||
4014 | 4019 | | |
4015 | 4020 | | |
4016 | 4021 | | |
4017 | | - | |
4018 | | - | |
4019 | 4022 | | |
4020 | 4023 | | |
4021 | 4024 | | |
4022 | 4025 | | |
| 4026 | + | |
| 4027 | + | |
| 4028 | + | |
| 4029 | + | |
| 4030 | + | |
4023 | 4031 | | |
4024 | 4032 | | |
4025 | 4033 | | |
| |||
0 commit comments