diff --git a/block/blk-mq.c b/block/blk-mq.c index b0888a89fa662df768a1d0e88e744324592302b6..2de972857496303438bc4a5eaf8a417ac93f562f 100644 --- a/block/blk-mq.c +++ b/block/blk-mq.c @@ -2833,7 +2833,8 @@ struct request_queue *blk_mq_init_allocated_queue(struct blk_mq_tag_set *set, q->tag_set = set; q->queue_flags |= QUEUE_FLAG_MQ_DEFAULT; - if (set->nr_maps > HCTX_TYPE_POLL) + if (set->nr_maps > HCTX_TYPE_POLL && + set->map[HCTX_TYPE_POLL].nr_queues) blk_queue_flag_set(QUEUE_FLAG_POLL, q); if (!(set->flags & BLK_MQ_F_SG_MERGE)) diff --git a/block/blk-sysfs.c b/block/blk-sysfs.c index bb7c642ffefa53e103134b52d5aa7ca4f84aeb73..0619c8922893a7372a07fa6ffdeec5d68c237609 100644 --- a/block/blk-sysfs.c +++ b/block/blk-sysfs.c @@ -402,7 +402,8 @@ static ssize_t queue_poll_store(struct request_queue *q, const char *page, unsigned long poll_on; ssize_t ret; - if (!q->tag_set || q->tag_set->nr_maps <= HCTX_TYPE_POLL) + if (!q->tag_set || q->tag_set->nr_maps <= HCTX_TYPE_POLL || + !q->tag_set->map[HCTX_TYPE_POLL].nr_queues) return -EINVAL; ret = queue_var_store(&poll_on, page, count);