Skip to content

Commit 307f406

Browse files
htejunaxboe
authored andcommitted
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 <[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]>
1 parent 9d179b8 commit 307f406

File tree

1 file changed

+5
-8
lines changed

1 file changed

+5
-8
lines changed

block/blk-rq-qos.h

+5-8
Original file line numberDiff line numberDiff line change
@@ -108,16 +108,13 @@ static inline void rq_qos_add(struct request_queue *q, struct rq_qos *rqos)
108108

109109
static inline void rq_qos_del(struct request_queue *q, struct rq_qos *rqos)
110110
{
111-
struct rq_qos *cur, *prev = NULL;
112-
for (cur = q->rq_qos; cur; cur = cur->next) {
113-
if (cur == rqos) {
114-
if (prev)
115-
prev->next = rqos->next;
116-
else
117-
q->rq_qos = cur;
111+
struct rq_qos **cur;
112+
113+
for (cur = &q->rq_qos; *cur; cur = &(*cur)->next) {
114+
if (*cur == rqos) {
115+
*cur = rqos->next;
118116
break;
119117
}
120-
prev = cur;
121118
}
122119

123120
blk_mq_debugfs_unregister_rqos(rqos);

0 commit comments

Comments
 (0)