All of lore.kernel.org
 help / color / mirror / Atom feed
From: Nilay Shroff <nilay@linux.ibm.com>
To: linux-block@vger.kernel.org
Cc: axboe@kernel.dk, kch@nvidia.com, shinichiro.kawasaki@wdc.com,
	hch@lst.de, ming.lei@redhat.com, gjoyce@ibm.com
Subject: [PATCH 2/2] block: clear QUEUE_FLAG_QOS_ENABLED in rq_qos_del()
Date: Mon,  4 Aug 2025 17:51:11 +0530	[thread overview]
Message-ID: <20250804122125.3271397-3-nilay@linux.ibm.com> (raw)
In-Reply-To: <20250804122125.3271397-1-nilay@linux.ibm.com>

When a QoS function is removed via rq_qos_del(), and it happens to be the
last QoS function on the request queue, q->rq_qos becomes NULL. In this
case, the QUEUE_FLAG_QOS_ENABLED bit should also be cleared to reflect
that no QoS hooks remain active.

This patch ensures that the QUEUE_FLAG_QOS_ENABLED flag is cleared if the
queue no longer has any associated rq_qos policies. Failing to do so
could cause unnecessary dereferences of a now-null q->rq_qos pointer in
the I/O path.

Signed-off-by: Nilay Shroff <nilay@linux.ibm.com>
---
 block/blk-rq-qos.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/block/blk-rq-qos.c b/block/blk-rq-qos.c
index 460c04715321..654478dfbc20 100644
--- a/block/blk-rq-qos.c
+++ b/block/blk-rq-qos.c
@@ -375,6 +375,8 @@ void rq_qos_del(struct rq_qos *rqos)
 			break;
 		}
 	}
+	if (!q->rq_qos)
+		blk_queue_flag_clear(QUEUE_FLAG_QOS_ENABLED, q);
 	blk_mq_unfreeze_queue(q, memflags);
 
 	mutex_lock(&q->debugfs_mutex);
-- 
2.50.1


  parent reply	other threads:[~2025-08-04 12:21 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-08-04 12:21 [PATCH 0/2] block: blk-rq-qos: replace static key with atomic bitop Nilay Shroff
2025-08-04 12:21 ` [PATCH 1/2] block: avoid cpu_hotplug_lock depedency on freeze_lock Nilay Shroff
2025-08-04 12:21 ` Nilay Shroff [this message]
2025-08-04 13:42 ` [PATCH 0/2] block: blk-rq-qos: replace static key with atomic bitop Ming Lei
2025-08-05  4:58   ` Nilay Shroff
2025-08-05 12:44     ` Ming Lei
2025-08-05 17:05       ` Nilay Shroff
2025-08-06  7:21         ` Ming Lei
2025-08-06  1:28     ` Jens Axboe
2025-08-06  1:44       ` Yu Kuai
2025-08-13 11:20         ` Nilay Shroff
2025-08-13 12:16           ` Jens Axboe
2025-08-13 15:01             ` Nilay Shroff
2025-08-06  5:13       ` Nilay Shroff
2025-08-05  9:28 ` Yu Kuai
2025-08-05 12:14   ` Nilay Shroff

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20250804122125.3271397-3-nilay@linux.ibm.com \
    --to=nilay@linux.ibm.com \
    --cc=axboe@kernel.dk \
    --cc=gjoyce@ibm.com \
    --cc=hch@lst.de \
    --cc=kch@nvidia.com \
    --cc=linux-block@vger.kernel.org \
    --cc=ming.lei@redhat.com \
    --cc=shinichiro.kawasaki@wdc.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.