Commit d0f411c0 authored by Jens Axboe's avatar Jens Axboe

Merge tag 'nvme-6.1-2022-01-02' of git://git.infradead.org/nvme into block-6.1

Pull NVMe fixes from Christoph:

"nvme fixes for Linux 6.1

 - fix SRCU protection of nvme_ns_head list (Caleb Sander)
 - clear the prp2 field when not used (Lei Rao)"

* tag 'nvme-6.1-2022-01-02' of git://git.infradead.org/nvme:
  nvme: fix SRCU protection of nvme_ns_head list
  nvme-pci: clear the prp2 field when not used
parents 7d4a9317 899d2a05
...@@ -4304,7 +4304,7 @@ static void nvme_ns_remove(struct nvme_ns *ns) ...@@ -4304,7 +4304,7 @@ static void nvme_ns_remove(struct nvme_ns *ns)
mutex_unlock(&ns->ctrl->subsys->lock); mutex_unlock(&ns->ctrl->subsys->lock);
/* guarantee not available in head->list */ /* guarantee not available in head->list */
synchronize_rcu(); synchronize_srcu(&ns->head->srcu);
if (!nvme_ns_head_multipath(ns->head)) if (!nvme_ns_head_multipath(ns->head))
nvme_cdev_del(&ns->cdev, &ns->cdev_device); nvme_cdev_del(&ns->cdev, &ns->cdev_device);
......
...@@ -174,11 +174,14 @@ void nvme_mpath_revalidate_paths(struct nvme_ns *ns) ...@@ -174,11 +174,14 @@ void nvme_mpath_revalidate_paths(struct nvme_ns *ns)
struct nvme_ns_head *head = ns->head; struct nvme_ns_head *head = ns->head;
sector_t capacity = get_capacity(head->disk); sector_t capacity = get_capacity(head->disk);
int node; int node;
int srcu_idx;
srcu_idx = srcu_read_lock(&head->srcu);
list_for_each_entry_rcu(ns, &head->list, siblings) { list_for_each_entry_rcu(ns, &head->list, siblings) {
if (capacity != get_capacity(ns->disk)) if (capacity != get_capacity(ns->disk))
clear_bit(NVME_NS_READY, &ns->flags); clear_bit(NVME_NS_READY, &ns->flags);
} }
srcu_read_unlock(&head->srcu, srcu_idx);
for_each_node(node) for_each_node(node)
rcu_assign_pointer(head->current_path[node], NULL); rcu_assign_pointer(head->current_path[node], NULL);
......
...@@ -797,6 +797,8 @@ static blk_status_t nvme_setup_prp_simple(struct nvme_dev *dev, ...@@ -797,6 +797,8 @@ static blk_status_t nvme_setup_prp_simple(struct nvme_dev *dev,
cmnd->dptr.prp1 = cpu_to_le64(iod->first_dma); cmnd->dptr.prp1 = cpu_to_le64(iod->first_dma);
if (bv->bv_len > first_prp_len) if (bv->bv_len > first_prp_len)
cmnd->dptr.prp2 = cpu_to_le64(iod->first_dma + first_prp_len); cmnd->dptr.prp2 = cpu_to_le64(iod->first_dma + first_prp_len);
else
cmnd->dptr.prp2 = 0;
return BLK_STS_OK; return BLK_STS_OK;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment