Skip to content

Commit c24b06e

Browse files
committed
Merge tag 'nvme-5.19-2022-07-14' of git://git.infradead.org/nvme into block-5.19
Pull NVMe fixes from Christoph: "nvme fixes for Linux 5.19 - fix a block device naming collision (Israel Rukshin) - fix freeze accounting for PCI error handling (Keith Busch)" * tag 'nvme-5.19-2022-07-14' of git://git.infradead.org/nvme: nvme: fix block device naming collision nvme-pci: fix freeze accounting for error handling
2 parents 6b0de7d + 6961b5e commit c24b06e

File tree

2 files changed

+10
-5
lines changed

2 files changed

+10
-5
lines changed

drivers/nvme/host/core.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3786,7 +3786,7 @@ static int nvme_add_ns_cdev(struct nvme_ns *ns)
37863786
}
37873787

37883788
static struct nvme_ns_head *nvme_alloc_ns_head(struct nvme_ctrl *ctrl,
3789-
unsigned nsid, struct nvme_ns_ids *ids)
3789+
unsigned nsid, struct nvme_ns_ids *ids, bool is_shared)
37903790
{
37913791
struct nvme_ns_head *head;
37923792
size_t size = sizeof(*head);
@@ -3810,6 +3810,7 @@ static struct nvme_ns_head *nvme_alloc_ns_head(struct nvme_ctrl *ctrl,
38103810
head->subsys = ctrl->subsys;
38113811
head->ns_id = nsid;
38123812
head->ids = *ids;
3813+
head->shared = is_shared;
38133814
kref_init(&head->ref);
38143815

38153816
if (head->ids.csi) {
@@ -3891,12 +3892,11 @@ static int nvme_init_ns_head(struct nvme_ns *ns, unsigned nsid,
38913892
nsid);
38923893
goto out_unlock;
38933894
}
3894-
head = nvme_alloc_ns_head(ctrl, nsid, ids);
3895+
head = nvme_alloc_ns_head(ctrl, nsid, ids, is_shared);
38953896
if (IS_ERR(head)) {
38963897
ret = PTR_ERR(head);
38973898
goto out_unlock;
38983899
}
3899-
head->shared = is_shared;
39003900
} else {
39013901
ret = -EINVAL;
39023902
if (!is_shared || !head->shared) {

drivers/nvme/host/pci.c

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2690,8 +2690,13 @@ static void nvme_dev_disable(struct nvme_dev *dev, bool shutdown)
26902690
struct pci_dev *pdev = to_pci_dev(dev->dev);
26912691

26922692
mutex_lock(&dev->shutdown_lock);
2693-
if (pci_device_is_present(pdev) && pci_is_enabled(pdev)) {
2694-
u32 csts = readl(dev->bar + NVME_REG_CSTS);
2693+
if (pci_is_enabled(pdev)) {
2694+
u32 csts;
2695+
2696+
if (pci_device_is_present(pdev))
2697+
csts = readl(dev->bar + NVME_REG_CSTS);
2698+
else
2699+
csts = ~0;
26952700

26962701
if (dev->ctrl.state == NVME_CTRL_LIVE ||
26972702
dev->ctrl.state == NVME_CTRL_RESETTING) {

0 commit comments

Comments
 (0)