1
0
Fork 0

blk-rq-qos: fix first node deletion of rq_qos_del()

rq_qos_del() incorrectly assigns the node being deleted to the head if
it was the first on the list in the !prev path.  Fix it by iterating
with ** instead.

Signed-off-by: Tejun Heo <tj@kernel.org>
Cc: Josef Bacik <josef@toxicpanda.com>
Fixes: a79050434b ("blk-rq-qos: refactor out common elements of blk-wbt")
Cc: stable@vger.kernel.org # v4.19+
Signed-off-by: Jens Axboe <axboe@kernel.dk>
alistair/sunxi64-5.4-dsi
Tejun Heo 2019-10-15 08:49:27 -07:00 committed by Jens Axboe
parent 9d179b8654
commit 307f4065b9
1 changed files with 5 additions and 8 deletions

View File

@ -108,16 +108,13 @@ static inline void rq_qos_add(struct request_queue *q, struct rq_qos *rqos)
static inline void rq_qos_del(struct request_queue *q, struct rq_qos *rqos) static inline void rq_qos_del(struct request_queue *q, struct rq_qos *rqos)
{ {
struct rq_qos *cur, *prev = NULL; struct rq_qos **cur;
for (cur = q->rq_qos; cur; cur = cur->next) {
if (cur == rqos) { for (cur = &q->rq_qos; *cur; cur = &(*cur)->next) {
if (prev) if (*cur == rqos) {
prev->next = rqos->next; *cur = rqos->next;
else
q->rq_qos = cur;
break; break;
} }
prev = cur;
} }
blk_mq_debugfs_unregister_rqos(rqos); blk_mq_debugfs_unregister_rqos(rqos);