linux-block.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] block: Fix elv_support_iosched()
@ 2019-10-07 22:12 Damien Le Moal
  2019-10-08  3:15 ` Jens Axboe
  0 siblings, 1 reply; 2+ messages in thread
From: Damien Le Moal @ 2019-10-07 22:12 UTC (permalink / raw)
  To: linux-block, Jens Axboe; +Cc: Shinichiro Kawasaki

A BIO based request queue does not have a tag_set, which prevent testing
for the flag BLK_MQ_F_NO_SCHED indicating that the queue does not
require an elevator. This leads to an incorrect initialization of a
default elevator in some cases such as BIO based nullblk (queue_mode ==
BIO) with zoned mode enabled as the default elevator in this case is
mq-deadline instead of "none".

Fix this by including the absence of a tag_set for a queue as an
indicator that the queue should not have an elevator.

Reported-by: Shinichiro Kawasaki <shinichiro.kawasaki@wdc.com>
Signed-off-by: Damien Le Moal <damien.lemoal@wdc.com>
---
 block/elevator.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/block/elevator.c b/block/elevator.c
index 5437059c9261..995d1e67056c 100644
--- a/block/elevator.c
+++ b/block/elevator.c
@@ -616,7 +616,7 @@ int elevator_switch_mq(struct request_queue *q,
 
 static inline bool elv_support_iosched(struct request_queue *q)
 {
-	if (q->tag_set && (q->tag_set->flags & BLK_MQ_F_NO_SCHED))
+	if (!q->tag_set || (q->tag_set->flags & BLK_MQ_F_NO_SCHED))
 		return false;
 	return true;
 }
-- 
2.21.0


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

* Re: [PATCH] block: Fix elv_support_iosched()
  2019-10-07 22:12 [PATCH] block: Fix elv_support_iosched() Damien Le Moal
@ 2019-10-08  3:15 ` Jens Axboe
  0 siblings, 0 replies; 2+ messages in thread
From: Jens Axboe @ 2019-10-08  3:15 UTC (permalink / raw)
  To: Damien Le Moal, linux-block; +Cc: Shinichiro Kawasaki

On 10/7/19 4:12 PM, Damien Le Moal wrote:
> A BIO based request queue does not have a tag_set, which prevent testing
> for the flag BLK_MQ_F_NO_SCHED indicating that the queue does not
> require an elevator. This leads to an incorrect initialization of a
> default elevator in some cases such as BIO based nullblk (queue_mode ==
> BIO) with zoned mode enabled as the default elevator in this case is
> mq-deadline instead of "none".
> 
> Fix this by including the absence of a tag_set for a queue as an
> indicator that the queue should not have an elevator.

Why not just check for mq_ops?

-- 
Jens Axboe


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

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

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-10-07 22:12 [PATCH] block: Fix elv_support_iosched() Damien Le Moal
2019-10-08  3:15 ` 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).