Commit 73aeab3
block, bfq: fix procress reference leakage for bfqq in merge chain
Original state:
Process 1 Process 2 Process 3 Process 4
(BIC1) (BIC2) (BIC3) (BIC4)
Λ | | |
\--------------\ \-------------\ \-------------\|
V V V
bfqq1--------->bfqq2---------->bfqq3----------->bfqq4
ref 0 1 2 4
After commit 0e456db ("block, bfq: choose the last bfqq from merge
chain in bfq_setup_cooperator()"), if P1 issues a new IO:
Without the patch:
Process 1 Process 2 Process 3 Process 4
(BIC1) (BIC2) (BIC3) (BIC4)
Λ | | |
\------------------------------\ \-------------\|
V V
bfqq1--------->bfqq2---------->bfqq3----------->bfqq4
ref 0 0 2 4
bfqq3 will be used to handle IO from P1, this is not expected, IO
should be redirected to bfqq4;
With the patch:
-------------------------------------------
| |
Process 1 Process 2 Process 3 | Process 4
(BIC1) (BIC2) (BIC3) | (BIC4)
| | | |
\-------------\ \-------------\|
V V
bfqq1--------->bfqq2---------->bfqq3----------->bfqq4
ref 0 0 2 4
IO is redirected to bfqq4, however, procress reference of bfqq3 is still
2, while there is only P2 using it.
Fix the problem by calling bfq_merge_bfqqs() for each bfqq in the merge
chain. Also change bfqq_merge_bfqqs() to return new_bfqq to simplify
code.
Fixes: 0e456db ("block, bfq: choose the last bfqq from merge chain in bfq_setup_cooperator()")
Signed-off-by: Yu Kuai <yukuai3@huawei.com>
Link: https://lore.kernel.org/r/20240909134154.954924-3-yukuai1@huaweicloud.com
Signed-off-by: Jens Axboe <axboe@kernel.dk>1 parent 1ba0403 commit 73aeab3
1 file changed
+17
-20
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3129 | 3129 | | |
3130 | 3130 | | |
3131 | 3131 | | |
3132 | | - | |
3133 | | - | |
3134 | | - | |
| 3132 | + | |
| 3133 | + | |
| 3134 | + | |
3135 | 3135 | | |
| 3136 | + | |
| 3137 | + | |
3136 | 3138 | | |
3137 | 3139 | | |
3138 | 3140 | | |
| |||
3226 | 3228 | | |
3227 | 3229 | | |
3228 | 3230 | | |
| 3231 | + | |
| 3232 | + | |
3229 | 3233 | | |
3230 | 3234 | | |
3231 | 3235 | | |
| |||
3261 | 3265 | | |
3262 | 3266 | | |
3263 | 3267 | | |
3264 | | - | |
3265 | | - | |
3266 | | - | |
3267 | | - | |
3268 | | - | |
3269 | | - | |
3270 | | - | |
3271 | | - | |
| 3268 | + | |
| 3269 | + | |
3272 | 3270 | | |
3273 | 3271 | | |
3274 | 3272 | | |
| |||
5705 | 5703 | | |
5706 | 5704 | | |
5707 | 5705 | | |
5708 | | - | |
5709 | | - | |
5710 | | - | |
| 5706 | + | |
5711 | 5707 | | |
5712 | 5708 | | |
5713 | 5709 | | |
| |||
6162 | 6158 | | |
6163 | 6159 | | |
6164 | 6160 | | |
| 6161 | + | |
6165 | 6162 | | |
6166 | 6163 | | |
6167 | 6164 | | |
| |||
6178 | 6175 | | |
6179 | 6176 | | |
6180 | 6177 | | |
6181 | | - | |
6182 | | - | |
6183 | | - | |
| 6178 | + | |
| 6179 | + | |
| 6180 | + | |
| 6181 | + | |
6184 | 6182 | | |
6185 | | - | |
| 6183 | + | |
6186 | 6184 | | |
6187 | 6185 | | |
6188 | 6186 | | |
6189 | 6187 | | |
6190 | | - | |
| 6188 | + | |
6191 | 6189 | | |
6192 | | - | |
6193 | 6190 | | |
6194 | 6191 | | |
6195 | 6192 | | |
| |||
0 commit comments