Skip to contentSkip to conversation

block: null_blk: only set set->nr_maps as 3 if active poll_queues is > 0

PATCH Applied Ming Lei 3 participants 3 messages Dec 24, 2021 Block layer

lore
Share & tools
lore

Ming Lei

author
#0 lore raw

PATCH 1/1 block: null_blk: only set set->nr_maps as 3 if active poll_queues is > 0

It isn't correct to set set->nr_maps as 3 if g_poll_queues is > 0 since we can change it via configfs for null_blk device created there, so only set it as 3 if active poll_queues is > 0.

Fixes divide zero exception reported by Shinichiro.

Fixes 2bfdbe8b7ebd ("null_blk: allow zero poll queues")
---
 drivers/block/null_blk/main.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/block/null_blk/main.c +1 -1
index 6be6ccd4a28f..13004beb48ca 100644
@@ -1892,7 +1892,7 @@ static int null_init_tag_set(struct nullb *nullb, struct blk_mq_tag_set *set)
 	if (g_shared_tag_bitmap)
 		set->flags |= BLK_MQ_F_TAG_HCTX_SHARED;
 	set->driver_data = nullb;
-	if (g_poll_queues)
+	if (poll_queues)
 		set->nr_maps = 3;
 	else
 		set->nr_maps = 1;
Signature · 1 line
2.31.1
Reviewed-by on v1 1/1
#1 lore raw
Quoted 9 lines · Ming Lei

It isn't correct to set set->nr_maps as 3 if g_poll_queues is > 0 since we can change it via configfs for null_blk device created there, so only set it as 3 if active poll_queues is > 0.

Fixes divide zero exception reported by Shinichiro.

Fixes 2bfdbe8b7ebd ("null_blk: allow zero poll queues")

Thanks for the fix. It looks good to me. Also, I confirmed the divide zero exception is avoided with this patch.

Signature · 2 lines
Best Regards,
Shin'ichiro Kawasaki
maintainer Applied
#2 lore raw
In reply to Ming Lei
Quoted 8 lines · Ming Lei

It isn't correct to set set->nr_maps as 3 if g_poll_queues is > 0 since we can change it via configfs for null_blk device created there, so only set it as 3 if active poll_queues is > 0.

Fixes divide zero exception reported by Shinichiro.

[...]

Applied, thanks!

[1/1] block: null_blk: only set set->nr_maps as 3 if active poll_queues is > 0

      commit: 19768f80cf23834e65482f1667ff54192d469fee

Best regards,

Signature · 1 line
Jens Axboe