Commit b491255
loop: Fix ABBA locking race
Current loop calls vfs_statfs() while holding the q->limits_lock. If
FS takes some locking in vfs_statfs callback, this may lead to ABBA
locking bug (at least, FAT fs has this issue actually).
So this patch calls vfs_statfs() outside q->limits_locks instead,
because looks like no reason to hold q->limits_locks while getting
discord configs.
Chain exists of:
&sbi->fat_lock --> &q->q_usage_counter(io)#17 --> &q->limits_lock
Possible unsafe locking scenario:
CPU0 CPU1
---- ----
lock(&q->limits_lock);
lock(&q->q_usage_counter(io)#17);
lock(&q->limits_lock);
lock(&sbi->fat_lock);
*** DEADLOCK ***
Reported-by: syzbot+a5d8c609c02f508672cc@syzkaller.appspotmail.com
Closes: https://syzkaller.appspot.com/bug?extid=a5d8c609c02f508672cc
Reviewed-by: Ming Lei <ming.lei@redhat.com>
Signed-off-by: OGAWA Hirofumi <hirofumi@mail.parknet.co.jp>
Signed-off-by: Jens Axboe <axboe@kernel.dk>1 parent 46fd48a commit b491255
1 file changed
+15
-15
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
770 | 770 | | |
771 | 771 | | |
772 | 772 | | |
773 | | - | |
774 | | - | |
| 773 | + | |
| 774 | + | |
775 | 775 | | |
776 | 776 | | |
777 | 777 | | |
778 | | - | |
779 | 778 | | |
780 | 779 | | |
781 | 780 | | |
| |||
788 | 787 | | |
789 | 788 | | |
790 | 789 | | |
791 | | - | |
792 | | - | |
| 790 | + | |
| 791 | + | |
793 | 792 | | |
794 | 793 | | |
795 | 794 | | |
796 | 795 | | |
797 | 796 | | |
798 | 797 | | |
799 | | - | |
800 | | - | |
| 798 | + | |
| 799 | + | |
801 | 800 | | |
802 | | - | |
803 | | - | |
804 | | - | |
805 | | - | |
806 | | - | |
807 | | - | |
808 | | - | |
809 | 801 | | |
810 | 802 | | |
811 | 803 | | |
| |||
991 | 983 | | |
992 | 984 | | |
993 | 985 | | |
| 986 | + | |
994 | 987 | | |
995 | 988 | | |
996 | 989 | | |
| |||
1000 | 993 | | |
1001 | 994 | | |
1002 | 995 | | |
| 996 | + | |
| 997 | + | |
1003 | 998 | | |
1004 | 999 | | |
1005 | 1000 | | |
| |||
1009 | 1004 | | |
1010 | 1005 | | |
1011 | 1006 | | |
1012 | | - | |
| 1007 | + | |
| 1008 | + | |
| 1009 | + | |
| 1010 | + | |
| 1011 | + | |
| 1012 | + | |
1013 | 1013 | | |
1014 | 1014 | | |
1015 | 1015 | | |
| |||
0 commit comments