linux-block.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH block/for-linus] blk-rq-qos: fix first node deletion of rq_qos_del()
@ 2019-10-15 15:49 Tejun Heo
  2019-10-15 16:13 ` Jens Axboe
  0 siblings, 1 reply; 2+ messages in thread
From: Tejun Heo @ 2019-10-15 15:49 UTC (permalink / raw)
  To: Jens Axboe; +Cc: linux-block, linux-kernel, kernel-team, Josef Bacik

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: a79050434b45 ("blk-rq-qos: refactor out common elements of blk-wbt")
Cc: stable@vger.kernel.org # v4.19+
---
 block/blk-rq-qos.h |   13 +++++--------
 1 file changed, 5 insertions(+), 8 deletions(-)

--- a/block/blk-rq-qos.h
+++ b/block/blk-rq-qos.h
@@ -108,16 +108,13 @@ static inline void rq_qos_add(struct req
 
 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);

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH block/for-linus] blk-rq-qos: fix first node deletion of rq_qos_del()
  2019-10-15 15:49 [PATCH block/for-linus] blk-rq-qos: fix first node deletion of rq_qos_del() Tejun Heo
@ 2019-10-15 16:13 ` Jens Axboe
  0 siblings, 0 replies; 2+ messages in thread
From: Jens Axboe @ 2019-10-15 16:13 UTC (permalink / raw)
  To: Tejun Heo; +Cc: linux-block, linux-kernel, kernel-team, Josef Bacik

On 10/15/19 9:49 AM, Tejun Heo wrote:
> 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.

Well, that's unfortunate... Applied.

-- 
Jens Axboe


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2019-10-15 16:14 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-10-15 15:49 [PATCH block/for-linus] blk-rq-qos: fix first node deletion of rq_qos_del() Tejun Heo
2019-10-15 16:13 ` Jens Axboe

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).