Commit 539d1b4
block: break pcpu_alloc_mutex dependency on freeze_lock
While nr_hw_update allocates tagset tags it acquires ->pcpu_alloc_mutex
after ->freeze_lock is acquired or queue is frozen. This potentially
creates a circular dependency involving ->fs_reclaim if reclaim is
triggered simultaneously in a code path which first acquires ->pcpu_
alloc_mutex. As the queue is already frozen while nr_hw_queue update
allocates tagsets, the reclaim can't forward progress and thus it could
cause a potential deadlock as reported in lockdep splat[1].
Fix this by pre-allocating tagset tags before we freeze queue during
nr_hw_queue update. Later the allocated tagset tags could be safely
installed and used after queue is frozen.
Reported-by: Yi Zhang <[email protected]>
Closes: https://lore.kernel.org/all/CAHj4cs8F=OV9s3La2kEQ34YndgfZP-B5PHS4Z8_b9euKG6J4mw@mail.gmail.com/ [1]
Signed-off-by: Nilay Shroff <[email protected]>
Reviewed-by: Ming Lei <[email protected]>
Tested-by: Yi Zhang <[email protected]>
Reviewed-by: Yu Kuai <[email protected]>
[axboe: fix brace style issue]
Signed-off-by: Jens Axboe <[email protected]>1 parent da46b5d commit 539d1b4
1 file changed
Lines changed: 30 additions & 15 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
4793 | 4793 | | |
4794 | 4794 | | |
4795 | 4795 | | |
4796 | | - | |
4797 | | - | |
| 4796 | + | |
| 4797 | + | |
| 4798 | + | |
4798 | 4799 | | |
4799 | 4800 | | |
4800 | 4801 | | |
4801 | 4802 | | |
4802 | 4803 | | |
4803 | | - | |
| 4804 | + | |
4804 | 4805 | | |
4805 | 4806 | | |
4806 | 4807 | | |
4807 | 4808 | | |
4808 | | - | |
| 4809 | + | |
4809 | 4810 | | |
4810 | 4811 | | |
4811 | 4812 | | |
4812 | 4813 | | |
4813 | | - | |
4814 | | - | |
4815 | 4814 | | |
4816 | 4815 | | |
4817 | | - | |
4818 | | - | |
4819 | | - | |
4820 | | - | |
| 4816 | + | |
| 4817 | + | |
| 4818 | + | |
| 4819 | + | |
| 4820 | + | |
| 4821 | + | |
| 4822 | + | |
4821 | 4823 | | |
4822 | 4824 | | |
4823 | 4825 | | |
4824 | 4826 | | |
4825 | | - | |
4826 | | - | |
4827 | | - | |
| 4827 | + | |
| 4828 | + | |
| 4829 | + | |
| 4830 | + | |
| 4831 | + | |
| 4832 | + | |
| 4833 | + | |
| 4834 | + | |
4828 | 4835 | | |
4829 | 4836 | | |
4830 | 4837 | | |
| |||
5113 | 5120 | | |
5114 | 5121 | | |
5115 | 5122 | | |
| 5123 | + | |
5116 | 5124 | | |
5117 | 5125 | | |
5118 | 5126 | | |
| |||
5147 | 5155 | | |
5148 | 5156 | | |
5149 | 5157 | | |
| 5158 | + | |
| 5159 | + | |
| 5160 | + | |
| 5161 | + | |
5150 | 5162 | | |
5151 | 5163 | | |
5152 | 5164 | | |
5153 | | - | |
5154 | | - | |
| 5165 | + | |
| 5166 | + | |
| 5167 | + | |
| 5168 | + | |
| 5169 | + | |
5155 | 5170 | | |
5156 | 5171 | | |
5157 | 5172 | | |
| |||
0 commit comments