提交 f63572df 编写于 作者: J Jon Derrick 提交者: Jens Axboe

nvme: unmap CMB and remove sysfs file in reset path

CMB doesn't get unmapped until removal while getting remapped on every
reset. Add the unmapping and sysfs file removal to the reset path in
nvme_pci_disable to match the mapping path in nvme_pci_enable.

Fixes: 202021c1 ("nvme : Add sysfs entry for NVMe CMBs when appropriate")
Signed-off-by: NJon Derrick <jonathan.derrick@intel.com>
Acked-by: NKeith Busch <keith.busch@intel.com>
Reviewed-By: NStephen Bates <sbates@raithlin.com>
Cc: <stable@vger.kernel.org> # 4.9+
Signed-off-by: NChristoph Hellwig <hch@lst.de>
Signed-off-by: NJens Axboe <axboe@fb.com>
上级 5f339453
...@@ -1510,6 +1510,11 @@ static inline void nvme_release_cmb(struct nvme_dev *dev) ...@@ -1510,6 +1510,11 @@ static inline void nvme_release_cmb(struct nvme_dev *dev)
if (dev->cmb) { if (dev->cmb) {
iounmap(dev->cmb); iounmap(dev->cmb);
dev->cmb = NULL; dev->cmb = NULL;
if (dev->cmbsz) {
sysfs_remove_file_from_group(&dev->ctrl.device->kobj,
&dev_attr_cmb.attr, NULL);
dev->cmbsz = 0;
}
} }
} }
...@@ -1783,6 +1788,7 @@ static void nvme_pci_disable(struct nvme_dev *dev) ...@@ -1783,6 +1788,7 @@ static void nvme_pci_disable(struct nvme_dev *dev)
{ {
struct pci_dev *pdev = to_pci_dev(dev->dev); struct pci_dev *pdev = to_pci_dev(dev->dev);
nvme_release_cmb(dev);
pci_free_irq_vectors(pdev); pci_free_irq_vectors(pdev);
if (pci_is_enabled(pdev)) { if (pci_is_enabled(pdev)) {
...@@ -2188,7 +2194,6 @@ static void nvme_remove(struct pci_dev *pdev) ...@@ -2188,7 +2194,6 @@ static void nvme_remove(struct pci_dev *pdev)
nvme_dev_disable(dev, true); nvme_dev_disable(dev, true);
nvme_dev_remove_admin(dev); nvme_dev_remove_admin(dev);
nvme_free_queues(dev, 0); nvme_free_queues(dev, 0);
nvme_release_cmb(dev);
nvme_release_prp_pools(dev); nvme_release_prp_pools(dev);
nvme_dev_unmap(dev); nvme_dev_unmap(dev);
nvme_put_ctrl(&dev->ctrl); nvme_put_ctrl(&dev->ctrl);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册