Skip to content

Commit d0f411c

Browse files
committed
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
2 parents 7d4a931 + 899d2a0 commit d0f411c

File tree

3 files changed

+6
-1
lines changed

3 files changed

+6
-1
lines changed

drivers/nvme/host/core.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4304,7 +4304,7 @@ static void nvme_ns_remove(struct nvme_ns *ns)
43044304
mutex_unlock(&ns->ctrl->subsys->lock);
43054305

43064306
/* guarantee not available in head->list */
4307-
synchronize_rcu();
4307+
synchronize_srcu(&ns->head->srcu);
43084308

43094309
if (!nvme_ns_head_multipath(ns->head))
43104310
nvme_cdev_del(&ns->cdev, &ns->cdev_device);

drivers/nvme/host/multipath.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -174,11 +174,14 @@ void nvme_mpath_revalidate_paths(struct nvme_ns *ns)
174174
struct nvme_ns_head *head = ns->head;
175175
sector_t capacity = get_capacity(head->disk);
176176
int node;
177+
int srcu_idx;
177178

179+
srcu_idx = srcu_read_lock(&head->srcu);
178180
list_for_each_entry_rcu(ns, &head->list, siblings) {
179181
if (capacity != get_capacity(ns->disk))
180182
clear_bit(NVME_NS_READY, &ns->flags);
181183
}
184+
srcu_read_unlock(&head->srcu, srcu_idx);
182185

183186
for_each_node(node)
184187
rcu_assign_pointer(head->current_path[node], NULL);

drivers/nvme/host/pci.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -797,6 +797,8 @@ static blk_status_t nvme_setup_prp_simple(struct nvme_dev *dev,
797797
cmnd->dptr.prp1 = cpu_to_le64(iod->first_dma);
798798
if (bv->bv_len > first_prp_len)
799799
cmnd->dptr.prp2 = cpu_to_le64(iod->first_dma + first_prp_len);
800+
else
801+
cmnd->dptr.prp2 = 0;
800802
return BLK_STS_OK;
801803
}
802804

0 commit comments

Comments
 (0)