Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 468f0987 authored by Jens Axboe's avatar Jens Axboe
Browse files

Merge branch 'for-jens' of git://git.infradead.org/nvme into for-linus

Pull NVMe fixes from Keith for 4.16-rc.

* 'for-jens' of git://git.infradead.org/nvme:
  nvmet: fix PSDT field check in command format
  nvme-multipath: fix sysfs dangerously created links
  nvme-pci: Fix nvme queue cleanup if IRQ setup fails
  nvmet-loop: use blk_rq_payload_bytes for sgl selection
  nvme-rdma: use blk_rq_payload_bytes instead of blk_rq_bytes
  nvme-fabrics: don't check for non-NULL module in nvmf_register_transport
parents 0979962f bffd2b61
Loading
Loading
Loading
Loading
+3 −9
Original line number Diff line number Diff line
@@ -2844,7 +2844,7 @@ static struct nvme_ns_head *nvme_alloc_ns_head(struct nvme_ctrl *ctrl,
}

static int nvme_init_ns_head(struct nvme_ns *ns, unsigned nsid,
		struct nvme_id_ns *id, bool *new)
		struct nvme_id_ns *id)
{
	struct nvme_ctrl *ctrl = ns->ctrl;
	bool is_shared = id->nmic & (1 << 0);
@@ -2860,8 +2860,6 @@ static int nvme_init_ns_head(struct nvme_ns *ns, unsigned nsid,
			ret = PTR_ERR(head);
			goto out_unlock;
		}

		*new = true;
	} else {
		struct nvme_ns_ids ids;

@@ -2873,8 +2871,6 @@ static int nvme_init_ns_head(struct nvme_ns *ns, unsigned nsid,
			ret = -EINVAL;
			goto out_unlock;
		}

		*new = false;
	}

	list_add_tail(&ns->siblings, &head->list);
@@ -2945,7 +2941,6 @@ static void nvme_alloc_ns(struct nvme_ctrl *ctrl, unsigned nsid)
	struct nvme_id_ns *id;
	char disk_name[DISK_NAME_LEN];
	int node = dev_to_node(ctrl->dev), flags = GENHD_FL_EXT_DEVT;
	bool new = true;

	ns = kzalloc_node(sizeof(*ns), GFP_KERNEL, node);
	if (!ns)
@@ -2971,7 +2966,7 @@ static void nvme_alloc_ns(struct nvme_ctrl *ctrl, unsigned nsid)
	if (id->ncap == 0)
		goto out_free_id;

	if (nvme_init_ns_head(ns, nsid, id, &new))
	if (nvme_init_ns_head(ns, nsid, id))
		goto out_free_id;
	nvme_setup_streams_ns(ctrl, ns);
	
@@ -3037,7 +3032,6 @@ static void nvme_alloc_ns(struct nvme_ctrl *ctrl, unsigned nsid)
		pr_warn("%s: failed to register lightnvm sysfs group for identification\n",
			ns->disk->disk_name);

	if (new)
	nvme_mpath_add_disk(ns->head);
	nvme_mpath_add_disk_links(ns);
	return;
+1 −1
Original line number Diff line number Diff line
@@ -493,7 +493,7 @@ EXPORT_SYMBOL_GPL(nvmf_should_reconnect);
 */
int nvmf_register_transport(struct nvmf_transport_ops *ops)
{
	if (!ops->create_ctrl || !ops->module)
	if (!ops->create_ctrl)
		return -EINVAL;

	down_write(&nvmf_transports_rwsem);
+10 −5
Original line number Diff line number Diff line
@@ -198,12 +198,17 @@ void nvme_mpath_add_disk(struct nvme_ns_head *head)
{
	if (!head->disk)
		return;

	mutex_lock(&head->subsys->lock);
	if (!(head->disk->flags & GENHD_FL_UP)) {
		device_add_disk(&head->subsys->dev, head->disk);
		if (sysfs_create_group(&disk_to_dev(head->disk)->kobj,
				&nvme_ns_id_attr_group))
			pr_warn("%s: failed to create sysfs group for identification\n",
				head->disk->disk_name);
	}
	mutex_unlock(&head->subsys->lock);
}

void nvme_mpath_add_disk_links(struct nvme_ns *ns)
{
+4 −1
Original line number Diff line number Diff line
@@ -1459,7 +1459,7 @@ static int nvme_create_queue(struct nvme_queue *nvmeq, int qid)
	nvmeq->cq_vector = qid - 1;
	result = adapter_alloc_cq(dev, qid, nvmeq);
	if (result < 0)
		return result;
		goto release_vector;

	result = adapter_alloc_sq(dev, qid, nvmeq);
	if (result < 0)
@@ -1473,9 +1473,12 @@ static int nvme_create_queue(struct nvme_queue *nvmeq, int qid)
	return result;

 release_sq:
	dev->online_queues--;
	adapter_delete_sq(dev, qid);
 release_cq:
	adapter_delete_cq(dev, qid);
 release_vector:
	nvmeq->cq_vector = -1;
	return result;
}

+2 −2
Original line number Diff line number Diff line
@@ -1051,7 +1051,7 @@ static void nvme_rdma_unmap_data(struct nvme_rdma_queue *queue,
	struct nvme_rdma_device *dev = queue->device;
	struct ib_device *ibdev = dev->dev;

	if (!blk_rq_bytes(rq))
	if (!blk_rq_payload_bytes(rq))
		return;

	if (req->mr) {
@@ -1166,7 +1166,7 @@ static int nvme_rdma_map_data(struct nvme_rdma_queue *queue,

	c->common.flags |= NVME_CMD_SGL_METABUF;

	if (!blk_rq_bytes(rq))
	if (!blk_rq_payload_bytes(rq))
		return nvme_rdma_set_sg_null(c);

	req->sg_table.sgl = req->first_sgl;
Loading