Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Merge tag 'block-5.13-2021-06-03' of git://git.kernel.dk/linux-block

Pull block fixes from Jens Axboe:
"NVMe fixes from Christoph:

- Fix corruption in RDMA in-capsule SGLs (Sagi Grimberg)

- nvme-loop reset fixes (Hannes Reinecke)

- nvmet fix for freeing unallocated p2pmem (Max Gurtovoy)"

* tag 'block-5.13-2021-06-03' of git://git.kernel.dk/linux-block:
nvmet: fix freeing unallocated p2pmem
nvme-loop: do not warn for deleted controllers during reset
nvme-loop: check for NVME_LOOP_Q_LIVE in nvme_loop_destroy_admin_queue()
nvme-loop: clear NVME_LOOP_Q_LIVE when nvme_loop_configure_admin_queue() fails
nvme-loop: reset queue count to 1 in nvme_loop_destroy_io_queues()
nvme-rdma: fix in-casule data send for chained sgls

+27 -22
+3 -2
drivers/nvme/host/rdma.c
··· 1320 1320 int count) 1321 1321 { 1322 1322 struct nvme_sgl_desc *sg = &c->common.dptr.sgl; 1323 - struct scatterlist *sgl = req->data_sgl.sg_table.sgl; 1324 1323 struct ib_sge *sge = &req->sge[1]; 1324 + struct scatterlist *sgl; 1325 1325 u32 len = 0; 1326 1326 int i; 1327 1327 1328 - for (i = 0; i < count; i++, sgl++, sge++) { 1328 + for_each_sg(req->data_sgl.sg_table.sgl, sgl, count, i) { 1329 1329 sge->addr = sg_dma_address(sgl); 1330 1330 sge->length = sg_dma_len(sgl); 1331 1331 sge->lkey = queue->device->pd->local_dma_lkey; 1332 1332 len += sge->length; 1333 + sge++; 1333 1334 } 1334 1335 1335 1336 sg->addr = cpu_to_le64(queue->ctrl->ctrl.icdoff);
+16 -17
drivers/nvme/target/core.c
··· 1005 1005 return req->transfer_len - req->metadata_len; 1006 1006 } 1007 1007 1008 - static int nvmet_req_alloc_p2pmem_sgls(struct nvmet_req *req) 1008 + static int nvmet_req_alloc_p2pmem_sgls(struct pci_dev *p2p_dev, 1009 + struct nvmet_req *req) 1009 1010 { 1010 - req->sg = pci_p2pmem_alloc_sgl(req->p2p_dev, &req->sg_cnt, 1011 + req->sg = pci_p2pmem_alloc_sgl(p2p_dev, &req->sg_cnt, 1011 1012 nvmet_data_transfer_len(req)); 1012 1013 if (!req->sg) 1013 1014 goto out_err; 1014 1015 1015 1016 if (req->metadata_len) { 1016 - req->metadata_sg = pci_p2pmem_alloc_sgl(req->p2p_dev, 1017 + req->metadata_sg = pci_p2pmem_alloc_sgl(p2p_dev, 1017 1018 &req->metadata_sg_cnt, req->metadata_len); 1018 1019 if (!req->metadata_sg) 1019 1020 goto out_free_sg; 1020 1021 } 1022 + 1023 + req->p2p_dev = p2p_dev; 1024 + 1021 1025 return 0; 1022 1026 out_free_sg: 1023 1027 pci_p2pmem_free_sgl(req->p2p_dev, req->sg); ··· 1029 1025 return -ENOMEM; 1030 1026 } 1031 1027 1032 - static bool nvmet_req_find_p2p_dev(struct nvmet_req *req) 1028 + static struct pci_dev *nvmet_req_find_p2p_dev(struct nvmet_req *req) 1033 1029 { 1034 - if (!IS_ENABLED(CONFIG_PCI_P2PDMA)) 1035 - return false; 1036 - 1037 - if (req->sq->ctrl && req->sq->qid && req->ns) { 1038 - req->p2p_dev = radix_tree_lookup(&req->sq->ctrl->p2p_ns_map, 1039 - req->ns->nsid); 1040 - if (req->p2p_dev) 1041 - return true; 1042 - } 1043 - 1044 - req->p2p_dev = NULL; 1045 - return false; 1030 + if (!IS_ENABLED(CONFIG_PCI_P2PDMA) || 1031 + !req->sq->ctrl || !req->sq->qid || !req->ns) 1032 + return NULL; 1033 + return radix_tree_lookup(&req->sq->ctrl->p2p_ns_map, req->ns->nsid); 1046 1034 } 1047 1035 1048 1036 int nvmet_req_alloc_sgls(struct nvmet_req *req) 1049 1037 { 1050 - if (nvmet_req_find_p2p_dev(req) && !nvmet_req_alloc_p2pmem_sgls(req)) 1038 + struct pci_dev *p2p_dev = nvmet_req_find_p2p_dev(req); 1039 + 1040 + if (p2p_dev && !nvmet_req_alloc_p2pmem_sgls(p2p_dev, req)) 1051 1041 return 0; 1052 1042 1053 1043 req->sg = sgl_alloc(nvmet_data_transfer_len(req), GFP_KERNEL, ··· 1070 1072 pci_p2pmem_free_sgl(req->p2p_dev, req->sg); 1071 1073 if (req->metadata_sg) 1072 1074 pci_p2pmem_free_sgl(req->p2p_dev, req->metadata_sg); 1075 + req->p2p_dev = NULL; 1073 1076 } else { 1074 1077 sgl_free(req->sg); 1075 1078 if (req->metadata_sg)
+8 -3
drivers/nvme/target/loop.c
··· 263 263 264 264 static void nvme_loop_destroy_admin_queue(struct nvme_loop_ctrl *ctrl) 265 265 { 266 - clear_bit(NVME_LOOP_Q_LIVE, &ctrl->queues[0].flags); 266 + if (!test_and_clear_bit(NVME_LOOP_Q_LIVE, &ctrl->queues[0].flags)) 267 + return; 267 268 nvmet_sq_destroy(&ctrl->queues[0].nvme_sq); 268 269 blk_cleanup_queue(ctrl->ctrl.admin_q); 269 270 blk_cleanup_queue(ctrl->ctrl.fabrics_q); ··· 300 299 clear_bit(NVME_LOOP_Q_LIVE, &ctrl->queues[i].flags); 301 300 nvmet_sq_destroy(&ctrl->queues[i].nvme_sq); 302 301 } 302 + ctrl->ctrl.queue_count = 1; 303 303 } 304 304 305 305 static int nvme_loop_init_io_queues(struct nvme_loop_ctrl *ctrl) ··· 407 405 return 0; 408 406 409 407 out_cleanup_queue: 408 + clear_bit(NVME_LOOP_Q_LIVE, &ctrl->queues[0].flags); 410 409 blk_cleanup_queue(ctrl->ctrl.admin_q); 411 410 out_cleanup_fabrics_q: 412 411 blk_cleanup_queue(ctrl->ctrl.fabrics_q); ··· 465 462 nvme_loop_shutdown_ctrl(ctrl); 466 463 467 464 if (!nvme_change_ctrl_state(&ctrl->ctrl, NVME_CTRL_CONNECTING)) { 468 - /* state change failure should never happen */ 469 - WARN_ON_ONCE(1); 465 + if (ctrl->ctrl.state != NVME_CTRL_DELETING && 466 + ctrl->ctrl.state != NVME_CTRL_DELETING_NOIO) 467 + /* state change failure for non-deleted ctrl? */ 468 + WARN_ON_ONCE(1); 470 469 return; 471 470 } 472 471