linux/drivers/nvme/host
Chaitanya Kulkarni b10907b815 nvme: fix qid param blk_mq_alloc_request_hctx
Only caller of the __nvme_submit_sync_cmd() with qid value not equal to
NVME_QID_ANY is nvmf_connect_io_queues(), where qid value is alway set
to > 0.

[1] __nvme_submit_sync_cmd() callers with  qid parameter from :-

        Caller                  |   qid parameter
------------------------------------------------------
* nvme_fc_connect_io_queues()   |
   nvmf_connect_io_queue()      |      qid > 0
* nvme_rdma_start_io_queues()   |
   nvme_rdma_start_queue()      |
    nvmf_connect_io_queues()    |      qid > 0
* nvme_tcp_start_io_queues()    |
   nvme_tcp_start_queue()       |
    nvmf_connect_io_queues()    |      qid > 0
* nvme_loop_connect_io_queues() |
   nvmf_connect_io_queues()     |      qid > 0

When qid value of the function parameter __nvme_submit_sync_cmd() is > 0
from above callers, we use blk_mq_alloc_request_hctx(), where we pass
last parameter as 0 if qid functional parameter value is set to 0 with
conditional operators, see 1002 :-

991 int __nvme_submit_sync_cmd(struct request_queue *q, struct nvme_command *cmd,
 992                 union nvme_result *result, void *buffer, unsigned bufflen,
 993                 int qid, int at_head, blk_mq_req_flags_t flags)
 994 {
 995         struct request *req;
 996         int ret;
 997
 998         if (qid == NVME_QID_ANY)
 999                 req = blk_mq_alloc_request(q, nvme_req_op(cmd), flags);
1000         else
1001                 req = blk_mq_alloc_request_hctx(q, nvme_req_op(cmd), flags,
1002                                                 qid ? qid - 1 : 0);
1003

But qid function parameter value of the __nvme_submit_sync_cmd() will
never be 0 from above caller list see [1], and all the other callers of
__nvme_submit_sync_cmd() use NVME_QID_ANY as qid value :-
1. nvme_submit_sync_cmd()
2. nvme_features()
3. nvme_sec_submit()
4. nvmf_reg_read32()
5. nvmf_reg_read64()
6. nvmf_ref_write32()
7. nvmf_connect_admin_queue()

Remove the conditional operator to pass the qid as 0 in the call to
blk_mq_alloc_requst_hctx().

Signed-off-by: Chaitanya Kulkarni <kch@nvidia.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
2022-08-02 17:14:47 -06:00
..
apple.c blk-mq: Drop blk_mq_ops.timeout 'reserved' arg 2022-07-06 06:33:53 -06:00
constants.c nvme: add support for TP4084 - Time-to-Ready Enhancements 2022-05-18 18:54:17 +02:00
core.c nvme: fix qid param blk_mq_alloc_request_hctx 2022-08-02 17:14:47 -06:00
fabrics.c nvme: remove unused timeout parameter 2022-08-02 17:14:47 -06:00
fabrics.h nvme-fabrics: add a request timeout helper 2022-05-16 08:07:25 +02:00
fault_inject.c block: remove the ->rq_disk field in struct request 2021-11-29 06:41:29 -07:00
fc.c blk-mq: Drop 'reserved' arg of busy_tag_iter_fn 2022-07-06 06:33:53 -06:00
fc.h nvme-fc: Update header and host for common definitions for LS handling 2020-05-09 16:18:33 -06:00
hwmon.c nvme-hwmon: Return error code when registration fails 2021-03-05 13:41:03 +01:00
ioctl.c nvme/host: Use the enum req_op and blk_opf_t types 2022-07-14 12:14:32 -06:00
Kconfig nvme-apple: Add initial Apple SoC NVMe driver 2022-05-02 17:24:45 +02:00
Makefile nvme-apple: Add initial Apple SoC NVMe driver 2022-05-02 17:24:45 +02:00
multipath.c block: move zone related fields to struct gendisk 2022-07-06 06:46:26 -06:00
nvme.h nvme: remove unused timeout parameter 2022-08-02 17:14:47 -06:00
pci.c for-5.20/block-2022-07-29 2022-08-02 13:46:35 -07:00
rdma.c for-5.20/block-2022-07-29 2022-08-02 13:46:35 -07:00
tcp.c for-5.20/block-2022-07-29 2022-08-02 13:46:35 -07:00
trace.c nvme: add set feature tracing support 2021-08-16 14:42:23 +02:00
trace.h nvme: use struct group for generic command dwords 2022-07-06 19:12:56 +02:00
zns.c block: pass a gendisk to blk_queue_max_open_zones and blk_queue_max_active_zones 2022-07-06 06:46:26 -06:00