Skip to content

Commit

Permalink
blk-rq-qos: fix first node deletion of rq_qos_del()
Browse files Browse the repository at this point in the history
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 <[email protected]>
Cc: Josef Bacik <[email protected]>
Fixes: a790504 ("blk-rq-qos: refactor out common elements of blk-wbt")
Cc: [email protected] # v4.19+
Signed-off-by: Jens Axboe <[email protected]>
  • Loading branch information
htejun authored and axboe committed Oct 15, 2019
1 parent 9d179b8 commit 307f406
Showing 1 changed file with 5 additions and 8 deletions.
13 changes: 5 additions & 8 deletions block/blk-rq-qos.h
Original file line number Diff line number Diff line change
Expand Up @@ -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)
{
struct rq_qos *cur, *prev = NULL;
for (cur = q->rq_qos; cur; cur = cur->next) {
if (cur == rqos) {
if (prev)
prev->next = rqos->next;
else
q->rq_qos = cur;
struct rq_qos **cur;

for (cur = &q->rq_qos; *cur; cur = &(*cur)->next) {
if (*cur == rqos) {
*cur = rqos->next;
break;
}
prev = cur;
}

blk_mq_debugfs_unregister_rqos(rqos);
Expand Down

0 comments on commit 307f406

Please sign in to comment.