nvmet-fc: fix failing max io queue connections
authorJames Smart <[email protected]>
Mon, 11 Sep 2017 23:16:53 +0000 (16:16 -0700)
committerJens Axboe <[email protected]>
Mon, 25 Sep 2017 14:56:05 +0000 (08:56 -0600)
fc transport is treating NVMET_NR_QUEUES as maximum queue count, e.g.
admin queue plus NVMET_NR_QUEUES-1 io queues.  But NVMET_NR_QUEUES is
the number of io queues, so maximum queue count is really
NVMET_NR_QUEUES+1.

Fix the handling in the target fc transport

Signed-off-by: James Smart <[email protected]>
Signed-off-by: Christoph Hellwig <[email protected]>
Signed-off-by: Jens Axboe <[email protected]>
drivers/nvme/target/fc.c

index 088f07250d7606ac6572f13171c238521300304a..c48c83d97e304169185ddfad622bed93155e0412 100644 (file)
@@ -148,7 +148,7 @@ struct nvmet_fc_tgt_assoc {
        u32                             a_id;
        struct nvmet_fc_tgtport         *tgtport;
        struct list_head                a_list;
-       struct nvmet_fc_tgt_queue       *queues[NVMET_NR_QUEUES];
+       struct nvmet_fc_tgt_queue       *queues[NVMET_NR_QUEUES + 1];
        struct kref                     ref;
 };
 
@@ -608,7 +608,7 @@ nvmet_fc_alloc_target_queue(struct nvmet_fc_tgt_assoc *assoc,
        unsigned long flags;
        int ret;
 
-       if (qid >= NVMET_NR_QUEUES)
+       if (qid > NVMET_NR_QUEUES)
                return NULL;
 
        queue = kzalloc((sizeof(*queue) +
@@ -888,7 +888,7 @@ nvmet_fc_delete_target_assoc(struct nvmet_fc_tgt_assoc *assoc)
        int i;
 
        spin_lock_irqsave(&tgtport->lock, flags);
-       for (i = NVMET_NR_QUEUES - 1; i >= 0; i--) {
+       for (i = NVMET_NR_QUEUES; i >= 0; i--) {
                queue = assoc->queues[i];
                if (queue) {
                        if (!nvmet_fc_tgt_q_get(queue))