nvme fixes for Linux 5.19

- fix a block device naming collision (Israel Rukshin)
  - fix freeze accounting for PCI error handling (Keith Busch)
 -----BEGIN PGP SIGNATURE-----
 
 iQI/BAABCgApFiEEgdbnc3r/njty3Iq9D55TZVIEUYMFAmLQKewLHGhjaEBsc3Qu
 ZGUACgkQD55TZVIEUYMHSw/+P5Y5p+hMz5OAlArUGa4gFcQxC9gNvZFfJv6lUnCr
 cos0lxe3WwFYfix1eWXQv1vKVYo+L4661QLZF9/g/4E3keGx48LphtPDfvAsu5am
 2SwMmOGnbFmf3f3WYOqXn8L34cy8CDRx3F7S9eRHJiWLuV4i4z7O2+mdDErp2tx5
 yKpY3F8RjIdc3X+w7RTZsPA6HAmBSc6/9zFOqc14F17MIoQ0loxRN85GJVR33ibJ
 vpPkywNP6Wiu8HsiiMA1SlXChBJePSSd3oWue1x+FkWEVyVp1aYp/BEpy6Iq2YmS
 HNYdkc6RfNBk5Qn+/vfiJYGVLWk2SkXlzsglLeMqeGIghFU9XpgRk52H2kxtqCIA
 58pJ8zZjPbRfI6o09+9J1/xoqGF+tH8FeQa5cIxKlFe76OG2DABCF355mhnA2Obf
 KDAMOjYOY2oh0VRLYVj4FSLkVHB8Gw2rlWQvpGuM+sQ9J2rTHI5AChM4vHv8uA/p
 eDgd7e7qv9JvFEshArTQUS5KKqpv1byaHMPRstKEUURQrWXb9xBzIRNdiqBq/bhF
 WW3Mb2Kcl5vvsD8JQgBgqvg4BglKlQXO+g0EIB+EMM59nYGzE/bX33Yp9wwEjLRO
 acjCl72dmy8Uh0fmIaX4Ohv646hyJa73ugQupe7Qv1wd0DHsph2xkx4xJBksNfuc
 afU=
 =IHPo
 -----END PGP SIGNATURE-----

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
This commit is contained in:
Jens Axboe 2022-07-14 10:29:56 -06:00
commit c24b06e1c2
2 changed files with 10 additions and 5 deletions

View file

@ -3786,7 +3786,7 @@ static int nvme_add_ns_cdev(struct nvme_ns *ns)
}
static struct nvme_ns_head *nvme_alloc_ns_head(struct nvme_ctrl *ctrl,
unsigned nsid, struct nvme_ns_ids *ids)
unsigned nsid, struct nvme_ns_ids *ids, bool is_shared)
{
struct nvme_ns_head *head;
size_t size = sizeof(*head);
@ -3810,6 +3810,7 @@ static struct nvme_ns_head *nvme_alloc_ns_head(struct nvme_ctrl *ctrl,
head->subsys = ctrl->subsys;
head->ns_id = nsid;
head->ids = *ids;
head->shared = is_shared;
kref_init(&head->ref);
if (head->ids.csi) {
@ -3891,12 +3892,11 @@ static int nvme_init_ns_head(struct nvme_ns *ns, unsigned nsid,
nsid);
goto out_unlock;
}
head = nvme_alloc_ns_head(ctrl, nsid, ids);
head = nvme_alloc_ns_head(ctrl, nsid, ids, is_shared);
if (IS_ERR(head)) {
ret = PTR_ERR(head);
goto out_unlock;
}
head->shared = is_shared;
} else {
ret = -EINVAL;
if (!is_shared || !head->shared) {

View file

@ -2690,8 +2690,13 @@ static void nvme_dev_disable(struct nvme_dev *dev, bool shutdown)
struct pci_dev *pdev = to_pci_dev(dev->dev);
mutex_lock(&dev->shutdown_lock);
if (pci_device_is_present(pdev) && pci_is_enabled(pdev)) {
u32 csts = readl(dev->bar + NVME_REG_CSTS);
if (pci_is_enabled(pdev)) {
u32 csts;
if (pci_device_is_present(pdev))
csts = readl(dev->bar + NVME_REG_CSTS);
else
csts = ~0;
if (dev->ctrl.state == NVME_CTRL_LIVE ||
dev->ctrl.state == NVME_CTRL_RESETTING) {