diff options
author | Jens Axboe <axboe@fb.com> | 2016-08-29 10:39:22 -0400 |
---|---|---|
committer | Jens Axboe <axboe@fb.com> | 2016-08-29 10:39:22 -0400 |
commit | d8d8d9d789097f91edaeee65b77523079fa8cf3f (patch) | |
tree | a5bd59f8c90a158dd7721a60abaece4866a2f47b | |
parent | 3eab887a55424fc2c27553b7bfe32330df83f7b8 (diff) | |
parent | 4d8c6a7946d53648d9ed0e3852a1c81ce07d40db (diff) |
Merge branch 'nvmf-4.8-rc' of git://git.infradead.org/nvme-fabrics into for-linus
Sagi writes:
Mostly stability fixes and cleanups:
- NQN endianess fix from Daniel
- possible use-after-free fix from Vincent
- nvme-rdma connect semantics fixes from Jay
- Remove redundant variables in rdma driver
- Kbuild fix from Christoph
- nvmf_host referencing fix from Christoph
- uninit variable fix from Colin
-rw-r--r-- | drivers/nvme/host/Kconfig | 2 | ||||
-rw-r--r-- | drivers/nvme/host/fabrics.c | 23 | ||||
-rw-r--r-- | drivers/nvme/host/fabrics.h | 2 | ||||
-rw-r--r-- | drivers/nvme/host/rdma.c | 46 | ||||
-rw-r--r-- | drivers/nvme/target/Kconfig | 2 | ||||
-rw-r--r-- | drivers/nvme/target/loop.c | 4 | ||||
-rw-r--r-- | drivers/nvme/target/rdma.c | 7 | ||||
-rw-r--r-- | include/linux/nvme.h | 2 |
8 files changed, 54 insertions, 34 deletions
diff --git a/drivers/nvme/host/Kconfig b/drivers/nvme/host/Kconfig index db39d53cdfb9..0c644f7bdf80 100644 --- a/drivers/nvme/host/Kconfig +++ b/drivers/nvme/host/Kconfig | |||
@@ -31,7 +31,7 @@ config NVME_FABRICS | |||
31 | config NVME_RDMA | 31 | config NVME_RDMA |
32 | tristate "NVM Express over Fabrics RDMA host driver" | 32 | tristate "NVM Express over Fabrics RDMA host driver" |
33 | depends on INFINIBAND | 33 | depends on INFINIBAND |
34 | depends on BLK_DEV_NVME | 34 | select NVME_CORE |
35 | select NVME_FABRICS | 35 | select NVME_FABRICS |
36 | select SG_POOL | 36 | select SG_POOL |
37 | help | 37 | help |
diff --git a/drivers/nvme/host/fabrics.c b/drivers/nvme/host/fabrics.c index dc996761042f..4eff49174466 100644 --- a/drivers/nvme/host/fabrics.c +++ b/drivers/nvme/host/fabrics.c | |||
@@ -47,8 +47,10 @@ static struct nvmf_host *nvmf_host_add(const char *hostnqn) | |||
47 | 47 | ||
48 | mutex_lock(&nvmf_hosts_mutex); | 48 | mutex_lock(&nvmf_hosts_mutex); |
49 | host = __nvmf_host_find(hostnqn); | 49 | host = __nvmf_host_find(hostnqn); |
50 | if (host) | 50 | if (host) { |
51 | kref_get(&host->ref); | ||
51 | goto out_unlock; | 52 | goto out_unlock; |
53 | } | ||
52 | 54 | ||
53 | host = kmalloc(sizeof(*host), GFP_KERNEL); | 55 | host = kmalloc(sizeof(*host), GFP_KERNEL); |
54 | if (!host) | 56 | if (!host) |
@@ -56,7 +58,7 @@ static struct nvmf_host *nvmf_host_add(const char *hostnqn) | |||
56 | 58 | ||
57 | kref_init(&host->ref); | 59 | kref_init(&host->ref); |
58 | memcpy(host->nqn, hostnqn, NVMF_NQN_SIZE); | 60 | memcpy(host->nqn, hostnqn, NVMF_NQN_SIZE); |
59 | uuid_le_gen(&host->id); | 61 | uuid_be_gen(&host->id); |
60 | 62 | ||
61 | list_add_tail(&host->list, &nvmf_hosts); | 63 | list_add_tail(&host->list, &nvmf_hosts); |
62 | out_unlock: | 64 | out_unlock: |
@@ -73,9 +75,9 @@ static struct nvmf_host *nvmf_host_default(void) | |||
73 | return NULL; | 75 | return NULL; |
74 | 76 | ||
75 | kref_init(&host->ref); | 77 | kref_init(&host->ref); |
76 | uuid_le_gen(&host->id); | 78 | uuid_be_gen(&host->id); |
77 | snprintf(host->nqn, NVMF_NQN_SIZE, | 79 | snprintf(host->nqn, NVMF_NQN_SIZE, |
78 | "nqn.2014-08.org.nvmexpress:NVMf:uuid:%pUl", &host->id); | 80 | "nqn.2014-08.org.nvmexpress:NVMf:uuid:%pUb", &host->id); |
79 | 81 | ||
80 | mutex_lock(&nvmf_hosts_mutex); | 82 | mutex_lock(&nvmf_hosts_mutex); |
81 | list_add_tail(&host->list, &nvmf_hosts); | 83 | list_add_tail(&host->list, &nvmf_hosts); |
@@ -363,7 +365,14 @@ int nvmf_connect_admin_queue(struct nvme_ctrl *ctrl) | |||
363 | cmd.connect.opcode = nvme_fabrics_command; | 365 | cmd.connect.opcode = nvme_fabrics_command; |
364 | cmd.connect.fctype = nvme_fabrics_type_connect; | 366 | cmd.connect.fctype = nvme_fabrics_type_connect; |
365 | cmd.connect.qid = 0; | 367 | cmd.connect.qid = 0; |
366 | cmd.connect.sqsize = cpu_to_le16(ctrl->sqsize); | 368 | |
369 | /* | ||
370 | * fabrics spec sets a minimum of depth 32 for admin queue, | ||
371 | * so set the queue with this depth always until | ||
372 | * justification otherwise. | ||
373 | */ | ||
374 | cmd.connect.sqsize = cpu_to_le16(NVMF_AQ_DEPTH - 1); | ||
375 | |||
367 | /* | 376 | /* |
368 | * Set keep-alive timeout in seconds granularity (ms * 1000) | 377 | * Set keep-alive timeout in seconds granularity (ms * 1000) |
369 | * and add a grace period for controller kato enforcement | 378 | * and add a grace period for controller kato enforcement |
@@ -375,7 +384,7 @@ int nvmf_connect_admin_queue(struct nvme_ctrl *ctrl) | |||
375 | if (!data) | 384 | if (!data) |
376 | return -ENOMEM; | 385 | return -ENOMEM; |
377 | 386 | ||
378 | memcpy(&data->hostid, &ctrl->opts->host->id, sizeof(uuid_le)); | 387 | memcpy(&data->hostid, &ctrl->opts->host->id, sizeof(uuid_be)); |
379 | data->cntlid = cpu_to_le16(0xffff); | 388 | data->cntlid = cpu_to_le16(0xffff); |
380 | strncpy(data->subsysnqn, ctrl->opts->subsysnqn, NVMF_NQN_SIZE); | 389 | strncpy(data->subsysnqn, ctrl->opts->subsysnqn, NVMF_NQN_SIZE); |
381 | strncpy(data->hostnqn, ctrl->opts->host->nqn, NVMF_NQN_SIZE); | 390 | strncpy(data->hostnqn, ctrl->opts->host->nqn, NVMF_NQN_SIZE); |
@@ -434,7 +443,7 @@ int nvmf_connect_io_queue(struct nvme_ctrl *ctrl, u16 qid) | |||
434 | if (!data) | 443 | if (!data) |
435 | return -ENOMEM; | 444 | return -ENOMEM; |
436 | 445 | ||
437 | memcpy(&data->hostid, &ctrl->opts->host->id, sizeof(uuid_le)); | 446 | memcpy(&data->hostid, &ctrl->opts->host->id, sizeof(uuid_be)); |
438 | data->cntlid = cpu_to_le16(ctrl->cntlid); | 447 | data->cntlid = cpu_to_le16(ctrl->cntlid); |
439 | strncpy(data->subsysnqn, ctrl->opts->subsysnqn, NVMF_NQN_SIZE); | 448 | strncpy(data->subsysnqn, ctrl->opts->subsysnqn, NVMF_NQN_SIZE); |
440 | strncpy(data->hostnqn, ctrl->opts->host->nqn, NVMF_NQN_SIZE); | 449 | strncpy(data->hostnqn, ctrl->opts->host->nqn, NVMF_NQN_SIZE); |
diff --git a/drivers/nvme/host/fabrics.h b/drivers/nvme/host/fabrics.h index 89df52c8be97..46e460aee52d 100644 --- a/drivers/nvme/host/fabrics.h +++ b/drivers/nvme/host/fabrics.h | |||
@@ -34,7 +34,7 @@ struct nvmf_host { | |||
34 | struct kref ref; | 34 | struct kref ref; |
35 | struct list_head list; | 35 | struct list_head list; |
36 | char nqn[NVMF_NQN_SIZE]; | 36 | char nqn[NVMF_NQN_SIZE]; |
37 | uuid_le id; | 37 | uuid_be id; |
38 | }; | 38 | }; |
39 | 39 | ||
40 | /** | 40 | /** |
diff --git a/drivers/nvme/host/rdma.c b/drivers/nvme/host/rdma.c index 8d2875b4c56d..ab545fb347a0 100644 --- a/drivers/nvme/host/rdma.c +++ b/drivers/nvme/host/rdma.c | |||
@@ -43,10 +43,6 @@ | |||
43 | 43 | ||
44 | #define NVME_RDMA_MAX_INLINE_SEGMENTS 1 | 44 | #define NVME_RDMA_MAX_INLINE_SEGMENTS 1 |
45 | 45 | ||
46 | #define NVME_RDMA_MAX_PAGES_PER_MR 512 | ||
47 | |||
48 | #define NVME_RDMA_DEF_RECONNECT_DELAY 20 | ||
49 | |||
50 | /* | 46 | /* |
51 | * We handle AEN commands ourselves and don't even let the | 47 | * We handle AEN commands ourselves and don't even let the |
52 | * block layer know about them. | 48 | * block layer know about them. |
@@ -77,7 +73,6 @@ struct nvme_rdma_request { | |||
77 | u32 num_sge; | 73 | u32 num_sge; |
78 | int nents; | 74 | int nents; |
79 | bool inline_data; | 75 | bool inline_data; |
80 | bool need_inval; | ||
81 | struct ib_reg_wr reg_wr; | 76 | struct ib_reg_wr reg_wr; |
82 | struct ib_cqe reg_cqe; | 77 | struct ib_cqe reg_cqe; |
83 | struct nvme_rdma_queue *queue; | 78 | struct nvme_rdma_queue *queue; |
@@ -286,7 +281,7 @@ static int nvme_rdma_reinit_request(void *data, struct request *rq) | |||
286 | struct nvme_rdma_request *req = blk_mq_rq_to_pdu(rq); | 281 | struct nvme_rdma_request *req = blk_mq_rq_to_pdu(rq); |
287 | int ret = 0; | 282 | int ret = 0; |
288 | 283 | ||
289 | if (!req->need_inval) | 284 | if (!req->mr->need_inval) |
290 | goto out; | 285 | goto out; |
291 | 286 | ||
292 | ib_dereg_mr(req->mr); | 287 | ib_dereg_mr(req->mr); |
@@ -298,7 +293,7 @@ static int nvme_rdma_reinit_request(void *data, struct request *rq) | |||
298 | req->mr = NULL; | 293 | req->mr = NULL; |
299 | } | 294 | } |
300 | 295 | ||
301 | req->need_inval = false; | 296 | req->mr->need_inval = false; |
302 | 297 | ||
303 | out: | 298 | out: |
304 | return ret; | 299 | return ret; |
@@ -645,7 +640,8 @@ static int nvme_rdma_init_io_queues(struct nvme_rdma_ctrl *ctrl) | |||
645 | int i, ret; | 640 | int i, ret; |
646 | 641 | ||
647 | for (i = 1; i < ctrl->queue_count; i++) { | 642 | for (i = 1; i < ctrl->queue_count; i++) { |
648 | ret = nvme_rdma_init_queue(ctrl, i, ctrl->ctrl.sqsize); | 643 | ret = nvme_rdma_init_queue(ctrl, i, |
644 | ctrl->ctrl.opts->queue_size); | ||
649 | if (ret) { | 645 | if (ret) { |
650 | dev_info(ctrl->ctrl.device, | 646 | dev_info(ctrl->ctrl.device, |
651 | "failed to initialize i/o queue: %d\n", ret); | 647 | "failed to initialize i/o queue: %d\n", ret); |
@@ -849,7 +845,7 @@ static void nvme_rdma_unmap_data(struct nvme_rdma_queue *queue, | |||
849 | if (!blk_rq_bytes(rq)) | 845 | if (!blk_rq_bytes(rq)) |
850 | return; | 846 | return; |
851 | 847 | ||
852 | if (req->need_inval) { | 848 | if (req->mr->need_inval) { |
853 | res = nvme_rdma_inv_rkey(queue, req); | 849 | res = nvme_rdma_inv_rkey(queue, req); |
854 | if (res < 0) { | 850 | if (res < 0) { |
855 | dev_err(ctrl->ctrl.device, | 851 | dev_err(ctrl->ctrl.device, |
@@ -935,7 +931,7 @@ static int nvme_rdma_map_sg_fr(struct nvme_rdma_queue *queue, | |||
935 | IB_ACCESS_REMOTE_READ | | 931 | IB_ACCESS_REMOTE_READ | |
936 | IB_ACCESS_REMOTE_WRITE; | 932 | IB_ACCESS_REMOTE_WRITE; |
937 | 933 | ||
938 | req->need_inval = true; | 934 | req->mr->need_inval = true; |
939 | 935 | ||
940 | sg->addr = cpu_to_le64(req->mr->iova); | 936 | sg->addr = cpu_to_le64(req->mr->iova); |
941 | put_unaligned_le24(req->mr->length, sg->length); | 937 | put_unaligned_le24(req->mr->length, sg->length); |
@@ -958,7 +954,7 @@ static int nvme_rdma_map_data(struct nvme_rdma_queue *queue, | |||
958 | 954 | ||
959 | req->num_sge = 1; | 955 | req->num_sge = 1; |
960 | req->inline_data = false; | 956 | req->inline_data = false; |
961 | req->need_inval = false; | 957 | req->mr->need_inval = false; |
962 | 958 | ||
963 | c->common.flags |= NVME_CMD_SGL_METABUF; | 959 | c->common.flags |= NVME_CMD_SGL_METABUF; |
964 | 960 | ||
@@ -1145,7 +1141,7 @@ static int nvme_rdma_process_nvme_rsp(struct nvme_rdma_queue *queue, | |||
1145 | 1141 | ||
1146 | if ((wc->wc_flags & IB_WC_WITH_INVALIDATE) && | 1142 | if ((wc->wc_flags & IB_WC_WITH_INVALIDATE) && |
1147 | wc->ex.invalidate_rkey == req->mr->rkey) | 1143 | wc->ex.invalidate_rkey == req->mr->rkey) |
1148 | req->need_inval = false; | 1144 | req->mr->need_inval = false; |
1149 | 1145 | ||
1150 | blk_mq_complete_request(rq, status); | 1146 | blk_mq_complete_request(rq, status); |
1151 | 1147 | ||
@@ -1278,8 +1274,22 @@ static int nvme_rdma_route_resolved(struct nvme_rdma_queue *queue) | |||
1278 | 1274 | ||
1279 | priv.recfmt = cpu_to_le16(NVME_RDMA_CM_FMT_1_0); | 1275 | priv.recfmt = cpu_to_le16(NVME_RDMA_CM_FMT_1_0); |
1280 | priv.qid = cpu_to_le16(nvme_rdma_queue_idx(queue)); | 1276 | priv.qid = cpu_to_le16(nvme_rdma_queue_idx(queue)); |
1281 | priv.hrqsize = cpu_to_le16(queue->queue_size); | 1277 | /* |
1282 | priv.hsqsize = cpu_to_le16(queue->queue_size); | 1278 | * set the admin queue depth to the minimum size |
1279 | * specified by the Fabrics standard. | ||
1280 | */ | ||
1281 | if (priv.qid == 0) { | ||
1282 | priv.hrqsize = cpu_to_le16(NVMF_AQ_DEPTH); | ||
1283 | priv.hsqsize = cpu_to_le16(NVMF_AQ_DEPTH - 1); | ||
1284 | } else { | ||
1285 | /* | ||
1286 | * current interpretation of the fabrics spec | ||
1287 | * is at minimum you make hrqsize sqsize+1, or a | ||
1288 | * 1's based representation of sqsize. | ||
1289 | */ | ||
1290 | priv.hrqsize = cpu_to_le16(queue->queue_size); | ||
1291 | priv.hsqsize = cpu_to_le16(queue->ctrl->ctrl.sqsize); | ||
1292 | } | ||
1283 | 1293 | ||
1284 | ret = rdma_connect(queue->cm_id, ¶m); | 1294 | ret = rdma_connect(queue->cm_id, ¶m); |
1285 | if (ret) { | 1295 | if (ret) { |
@@ -1319,7 +1329,7 @@ out_destroy_queue_ib: | |||
1319 | static int nvme_rdma_device_unplug(struct nvme_rdma_queue *queue) | 1329 | static int nvme_rdma_device_unplug(struct nvme_rdma_queue *queue) |
1320 | { | 1330 | { |
1321 | struct nvme_rdma_ctrl *ctrl = queue->ctrl; | 1331 | struct nvme_rdma_ctrl *ctrl = queue->ctrl; |
1322 | int ret; | 1332 | int ret = 0; |
1323 | 1333 | ||
1324 | /* Own the controller deletion */ | 1334 | /* Own the controller deletion */ |
1325 | if (!nvme_change_ctrl_state(&ctrl->ctrl, NVME_CTRL_DELETING)) | 1335 | if (!nvme_change_ctrl_state(&ctrl->ctrl, NVME_CTRL_DELETING)) |
@@ -1461,7 +1471,7 @@ static int nvme_rdma_queue_rq(struct blk_mq_hw_ctx *hctx, | |||
1461 | if (rq->cmd_type == REQ_TYPE_FS && req_op(rq) == REQ_OP_FLUSH) | 1471 | if (rq->cmd_type == REQ_TYPE_FS && req_op(rq) == REQ_OP_FLUSH) |
1462 | flush = true; | 1472 | flush = true; |
1463 | ret = nvme_rdma_post_send(queue, sqe, req->sge, req->num_sge, | 1473 | ret = nvme_rdma_post_send(queue, sqe, req->sge, req->num_sge, |
1464 | req->need_inval ? &req->reg_wr.wr : NULL, flush); | 1474 | req->mr->need_inval ? &req->reg_wr.wr : NULL, flush); |
1465 | if (ret) { | 1475 | if (ret) { |
1466 | nvme_rdma_unmap_data(queue, rq); | 1476 | nvme_rdma_unmap_data(queue, rq); |
1467 | goto err; | 1477 | goto err; |
@@ -1816,7 +1826,7 @@ static int nvme_rdma_create_io_queues(struct nvme_rdma_ctrl *ctrl) | |||
1816 | 1826 | ||
1817 | memset(&ctrl->tag_set, 0, sizeof(ctrl->tag_set)); | 1827 | memset(&ctrl->tag_set, 0, sizeof(ctrl->tag_set)); |
1818 | ctrl->tag_set.ops = &nvme_rdma_mq_ops; | 1828 | ctrl->tag_set.ops = &nvme_rdma_mq_ops; |
1819 | ctrl->tag_set.queue_depth = ctrl->ctrl.sqsize; | 1829 | ctrl->tag_set.queue_depth = ctrl->ctrl.opts->queue_size; |
1820 | ctrl->tag_set.reserved_tags = 1; /* fabric connect */ | 1830 | ctrl->tag_set.reserved_tags = 1; /* fabric connect */ |
1821 | ctrl->tag_set.numa_node = NUMA_NO_NODE; | 1831 | ctrl->tag_set.numa_node = NUMA_NO_NODE; |
1822 | ctrl->tag_set.flags = BLK_MQ_F_SHOULD_MERGE; | 1832 | ctrl->tag_set.flags = BLK_MQ_F_SHOULD_MERGE; |
@@ -1914,7 +1924,7 @@ static struct nvme_ctrl *nvme_rdma_create_ctrl(struct device *dev, | |||
1914 | spin_lock_init(&ctrl->lock); | 1924 | spin_lock_init(&ctrl->lock); |
1915 | 1925 | ||
1916 | ctrl->queue_count = opts->nr_io_queues + 1; /* +1 for admin queue */ | 1926 | ctrl->queue_count = opts->nr_io_queues + 1; /* +1 for admin queue */ |
1917 | ctrl->ctrl.sqsize = opts->queue_size; | 1927 | ctrl->ctrl.sqsize = opts->queue_size - 1; |
1918 | ctrl->ctrl.kato = opts->kato; | 1928 | ctrl->ctrl.kato = opts->kato; |
1919 | 1929 | ||
1920 | ret = -ENOMEM; | 1930 | ret = -ENOMEM; |
diff --git a/drivers/nvme/target/Kconfig b/drivers/nvme/target/Kconfig index a5c31cbeb481..3a5b9d0576cb 100644 --- a/drivers/nvme/target/Kconfig +++ b/drivers/nvme/target/Kconfig | |||
@@ -15,8 +15,8 @@ config NVME_TARGET | |||
15 | 15 | ||
16 | config NVME_TARGET_LOOP | 16 | config NVME_TARGET_LOOP |
17 | tristate "NVMe loopback device support" | 17 | tristate "NVMe loopback device support" |
18 | depends on BLK_DEV_NVME | ||
19 | depends on NVME_TARGET | 18 | depends on NVME_TARGET |
19 | select NVME_CORE | ||
20 | select NVME_FABRICS | 20 | select NVME_FABRICS |
21 | select SG_POOL | 21 | select SG_POOL |
22 | help | 22 | help |
diff --git a/drivers/nvme/target/loop.c b/drivers/nvme/target/loop.c index 7affd40a6b33..395e60dad835 100644 --- a/drivers/nvme/target/loop.c +++ b/drivers/nvme/target/loop.c | |||
@@ -556,7 +556,7 @@ static int nvme_loop_create_io_queues(struct nvme_loop_ctrl *ctrl) | |||
556 | 556 | ||
557 | memset(&ctrl->tag_set, 0, sizeof(ctrl->tag_set)); | 557 | memset(&ctrl->tag_set, 0, sizeof(ctrl->tag_set)); |
558 | ctrl->tag_set.ops = &nvme_loop_mq_ops; | 558 | ctrl->tag_set.ops = &nvme_loop_mq_ops; |
559 | ctrl->tag_set.queue_depth = ctrl->ctrl.sqsize; | 559 | ctrl->tag_set.queue_depth = ctrl->ctrl.opts->queue_size; |
560 | ctrl->tag_set.reserved_tags = 1; /* fabric connect */ | 560 | ctrl->tag_set.reserved_tags = 1; /* fabric connect */ |
561 | ctrl->tag_set.numa_node = NUMA_NO_NODE; | 561 | ctrl->tag_set.numa_node = NUMA_NO_NODE; |
562 | ctrl->tag_set.flags = BLK_MQ_F_SHOULD_MERGE; | 562 | ctrl->tag_set.flags = BLK_MQ_F_SHOULD_MERGE; |
@@ -620,7 +620,7 @@ static struct nvme_ctrl *nvme_loop_create_ctrl(struct device *dev, | |||
620 | 620 | ||
621 | ret = -ENOMEM; | 621 | ret = -ENOMEM; |
622 | 622 | ||
623 | ctrl->ctrl.sqsize = opts->queue_size; | 623 | ctrl->ctrl.sqsize = opts->queue_size - 1; |
624 | ctrl->ctrl.kato = opts->kato; | 624 | ctrl->ctrl.kato = opts->kato; |
625 | 625 | ||
626 | ctrl->queues = kcalloc(opts->nr_io_queues + 1, sizeof(*ctrl->queues), | 626 | ctrl->queues = kcalloc(opts->nr_io_queues + 1, sizeof(*ctrl->queues), |
diff --git a/drivers/nvme/target/rdma.c b/drivers/nvme/target/rdma.c index b4d648536c3e..1cbe6e053b5b 100644 --- a/drivers/nvme/target/rdma.c +++ b/drivers/nvme/target/rdma.c | |||
@@ -978,10 +978,11 @@ static void nvmet_rdma_release_queue_work(struct work_struct *w) | |||
978 | container_of(w, struct nvmet_rdma_queue, release_work); | 978 | container_of(w, struct nvmet_rdma_queue, release_work); |
979 | struct rdma_cm_id *cm_id = queue->cm_id; | 979 | struct rdma_cm_id *cm_id = queue->cm_id; |
980 | struct nvmet_rdma_device *dev = queue->dev; | 980 | struct nvmet_rdma_device *dev = queue->dev; |
981 | enum nvmet_rdma_queue_state state = queue->state; | ||
981 | 982 | ||
982 | nvmet_rdma_free_queue(queue); | 983 | nvmet_rdma_free_queue(queue); |
983 | 984 | ||
984 | if (queue->state != NVMET_RDMA_IN_DEVICE_REMOVAL) | 985 | if (state != NVMET_RDMA_IN_DEVICE_REMOVAL) |
985 | rdma_destroy_id(cm_id); | 986 | rdma_destroy_id(cm_id); |
986 | 987 | ||
987 | kref_put(&dev->ref, nvmet_rdma_free_dev); | 988 | kref_put(&dev->ref, nvmet_rdma_free_dev); |
@@ -1003,10 +1004,10 @@ nvmet_rdma_parse_cm_connect_req(struct rdma_conn_param *conn, | |||
1003 | queue->host_qid = le16_to_cpu(req->qid); | 1004 | queue->host_qid = le16_to_cpu(req->qid); |
1004 | 1005 | ||
1005 | /* | 1006 | /* |
1006 | * req->hsqsize corresponds to our recv queue size | 1007 | * req->hsqsize corresponds to our recv queue size plus 1 |
1007 | * req->hrqsize corresponds to our send queue size | 1008 | * req->hrqsize corresponds to our send queue size |
1008 | */ | 1009 | */ |
1009 | queue->recv_queue_size = le16_to_cpu(req->hsqsize); | 1010 | queue->recv_queue_size = le16_to_cpu(req->hsqsize) + 1; |
1010 | queue->send_queue_size = le16_to_cpu(req->hrqsize); | 1011 | queue->send_queue_size = le16_to_cpu(req->hrqsize); |
1011 | 1012 | ||
1012 | if (!queue->host_qid && queue->recv_queue_size > NVMF_AQ_DEPTH) | 1013 | if (!queue->host_qid && queue->recv_queue_size > NVMF_AQ_DEPTH) |
diff --git a/include/linux/nvme.h b/include/linux/nvme.h index d8b37bab2887..7676557ce357 100644 --- a/include/linux/nvme.h +++ b/include/linux/nvme.h | |||
@@ -794,7 +794,7 @@ struct nvmf_connect_command { | |||
794 | }; | 794 | }; |
795 | 795 | ||
796 | struct nvmf_connect_data { | 796 | struct nvmf_connect_data { |
797 | uuid_le hostid; | 797 | uuid_be hostid; |
798 | __le16 cntlid; | 798 | __le16 cntlid; |
799 | char resv4[238]; | 799 | char resv4[238]; |
800 | char subsysnqn[NVMF_NQN_FIELD_LEN]; | 800 | char subsysnqn[NVMF_NQN_FIELD_LEN]; |