aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--MAINTAINERS2
-rw-r--r--block/blk-mq.c4
-rw-r--r--drivers/md/bcache/alloc.c2
-rw-r--r--drivers/md/bcache/btree.c2
-rw-r--r--drivers/md/bcache/writeback.c3
-rw-r--r--drivers/nvme/host/core.c37
-rw-r--r--drivers/nvme/host/nvme.h1
-rw-r--r--drivers/nvme/host/pci.c23
-rw-r--r--include/uapi/linux/nvme_ioctl.h1
9 files changed, 61 insertions, 14 deletions
diff --git a/MAINTAINERS b/MAINTAINERS
index c68eaeb5a5c0..f2d7337ebdb3 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -2304,7 +2304,7 @@ BCACHE (BLOCK LAYER CACHE)
2304M: Kent Overstreet <kent.overstreet@gmail.com> 2304M: Kent Overstreet <kent.overstreet@gmail.com>
2305L: linux-bcache@vger.kernel.org 2305L: linux-bcache@vger.kernel.org
2306W: http://bcache.evilpiepirate.org 2306W: http://bcache.evilpiepirate.org
2307S: Maintained 2307S: Orphan
2308F: drivers/md/bcache/ 2308F: drivers/md/bcache/
2309 2309
2310BDISP ST MEDIA DRIVER 2310BDISP ST MEDIA DRIVER
diff --git a/block/blk-mq.c b/block/blk-mq.c
index 7df9c9263b21..29cbc1b5fbdb 100644
--- a/block/blk-mq.c
+++ b/block/blk-mq.c
@@ -2020,7 +2020,7 @@ struct request_queue *blk_mq_init_allocated_queue(struct blk_mq_tag_set *set,
2020 2020
2021 q->queue_ctx = alloc_percpu(struct blk_mq_ctx); 2021 q->queue_ctx = alloc_percpu(struct blk_mq_ctx);
2022 if (!q->queue_ctx) 2022 if (!q->queue_ctx)
2023 return ERR_PTR(-ENOMEM); 2023 goto err_exit;
2024 2024
2025 q->queue_hw_ctx = kzalloc_node(nr_cpu_ids * sizeof(*(q->queue_hw_ctx)), 2025 q->queue_hw_ctx = kzalloc_node(nr_cpu_ids * sizeof(*(q->queue_hw_ctx)),
2026 GFP_KERNEL, set->numa_node); 2026 GFP_KERNEL, set->numa_node);
@@ -2084,6 +2084,8 @@ err_map:
2084 kfree(q->queue_hw_ctx); 2084 kfree(q->queue_hw_ctx);
2085err_percpu: 2085err_percpu:
2086 free_percpu(q->queue_ctx); 2086 free_percpu(q->queue_ctx);
2087err_exit:
2088 q->mq_ops = NULL;
2087 return ERR_PTR(-ENOMEM); 2089 return ERR_PTR(-ENOMEM);
2088} 2090}
2089EXPORT_SYMBOL(blk_mq_init_allocated_queue); 2091EXPORT_SYMBOL(blk_mq_init_allocated_queue);
diff --git a/drivers/md/bcache/alloc.c b/drivers/md/bcache/alloc.c
index 8eeab72b93e2..ca4abe1ccd8d 100644
--- a/drivers/md/bcache/alloc.c
+++ b/drivers/md/bcache/alloc.c
@@ -64,7 +64,6 @@
64#include "btree.h" 64#include "btree.h"
65 65
66#include <linux/blkdev.h> 66#include <linux/blkdev.h>
67#include <linux/freezer.h>
68#include <linux/kthread.h> 67#include <linux/kthread.h>
69#include <linux/random.h> 68#include <linux/random.h>
70#include <trace/events/bcache.h> 69#include <trace/events/bcache.h>
@@ -288,7 +287,6 @@ do { \
288 if (kthread_should_stop()) \ 287 if (kthread_should_stop()) \
289 return 0; \ 288 return 0; \
290 \ 289 \
291 try_to_freeze(); \
292 schedule(); \ 290 schedule(); \
293 mutex_lock(&(ca)->set->bucket_lock); \ 291 mutex_lock(&(ca)->set->bucket_lock); \
294 } \ 292 } \
diff --git a/drivers/md/bcache/btree.c b/drivers/md/bcache/btree.c
index 22b9e34ceb75..eab505ee0027 100644
--- a/drivers/md/bcache/btree.c
+++ b/drivers/md/bcache/btree.c
@@ -27,7 +27,6 @@
27 27
28#include <linux/slab.h> 28#include <linux/slab.h>
29#include <linux/bitops.h> 29#include <linux/bitops.h>
30#include <linux/freezer.h>
31#include <linux/hash.h> 30#include <linux/hash.h>
32#include <linux/kthread.h> 31#include <linux/kthread.h>
33#include <linux/prefetch.h> 32#include <linux/prefetch.h>
@@ -1787,7 +1786,6 @@ again:
1787 1786
1788 mutex_unlock(&c->bucket_lock); 1787 mutex_unlock(&c->bucket_lock);
1789 1788
1790 try_to_freeze();
1791 schedule(); 1789 schedule();
1792 } 1790 }
1793 1791
diff --git a/drivers/md/bcache/writeback.c b/drivers/md/bcache/writeback.c
index b9346cd9cda1..60123677b382 100644
--- a/drivers/md/bcache/writeback.c
+++ b/drivers/md/bcache/writeback.c
@@ -12,7 +12,6 @@
12#include "writeback.h" 12#include "writeback.h"
13 13
14#include <linux/delay.h> 14#include <linux/delay.h>
15#include <linux/freezer.h>
16#include <linux/kthread.h> 15#include <linux/kthread.h>
17#include <trace/events/bcache.h> 16#include <trace/events/bcache.h>
18 17
@@ -228,7 +227,6 @@ static void read_dirty(struct cached_dev *dc)
228 */ 227 */
229 228
230 while (!kthread_should_stop()) { 229 while (!kthread_should_stop()) {
231 try_to_freeze();
232 230
233 w = bch_keybuf_next(&dc->writeback_keys); 231 w = bch_keybuf_next(&dc->writeback_keys);
234 if (!w) 232 if (!w)
@@ -433,7 +431,6 @@ static int bch_writeback_thread(void *arg)
433 if (kthread_should_stop()) 431 if (kthread_should_stop())
434 return 0; 432 return 0;
435 433
436 try_to_freeze();
437 schedule(); 434 schedule();
438 continue; 435 continue;
439 } 436 }
diff --git a/drivers/nvme/host/core.c b/drivers/nvme/host/core.c
index 2de248bd462b..1a51584a382b 100644
--- a/drivers/nvme/host/core.c
+++ b/drivers/nvme/host/core.c
@@ -95,6 +95,15 @@ bool nvme_change_ctrl_state(struct nvme_ctrl *ctrl,
95 break; 95 break;
96 } 96 }
97 break; 97 break;
98 case NVME_CTRL_DEAD:
99 switch (old_state) {
100 case NVME_CTRL_DELETING:
101 changed = true;
102 /* FALLTHRU */
103 default:
104 break;
105 }
106 break;
98 default: 107 default:
99 break; 108 break;
100 } 109 }
@@ -720,10 +729,14 @@ static void nvme_init_integrity(struct nvme_ns *ns)
720 switch (ns->pi_type) { 729 switch (ns->pi_type) {
721 case NVME_NS_DPS_PI_TYPE3: 730 case NVME_NS_DPS_PI_TYPE3:
722 integrity.profile = &t10_pi_type3_crc; 731 integrity.profile = &t10_pi_type3_crc;
732 integrity.tag_size = sizeof(u16) + sizeof(u32);
733 integrity.flags |= BLK_INTEGRITY_DEVICE_CAPABLE;
723 break; 734 break;
724 case NVME_NS_DPS_PI_TYPE1: 735 case NVME_NS_DPS_PI_TYPE1:
725 case NVME_NS_DPS_PI_TYPE2: 736 case NVME_NS_DPS_PI_TYPE2:
726 integrity.profile = &t10_pi_type1_crc; 737 integrity.profile = &t10_pi_type1_crc;
738 integrity.tag_size = sizeof(u16);
739 integrity.flags |= BLK_INTEGRITY_DEVICE_CAPABLE;
727 break; 740 break;
728 default: 741 default:
729 integrity.profile = NULL; 742 integrity.profile = NULL;
@@ -1212,6 +1225,9 @@ static long nvme_dev_ioctl(struct file *file, unsigned int cmd,
1212 return ctrl->ops->reset_ctrl(ctrl); 1225 return ctrl->ops->reset_ctrl(ctrl);
1213 case NVME_IOCTL_SUBSYS_RESET: 1226 case NVME_IOCTL_SUBSYS_RESET:
1214 return nvme_reset_subsystem(ctrl); 1227 return nvme_reset_subsystem(ctrl);
1228 case NVME_IOCTL_RESCAN:
1229 nvme_queue_scan(ctrl);
1230 return 0;
1215 default: 1231 default:
1216 return -ENOTTY; 1232 return -ENOTTY;
1217 } 1233 }
@@ -1239,6 +1255,17 @@ static ssize_t nvme_sysfs_reset(struct device *dev,
1239} 1255}
1240static DEVICE_ATTR(reset_controller, S_IWUSR, NULL, nvme_sysfs_reset); 1256static DEVICE_ATTR(reset_controller, S_IWUSR, NULL, nvme_sysfs_reset);
1241 1257
1258static ssize_t nvme_sysfs_rescan(struct device *dev,
1259 struct device_attribute *attr, const char *buf,
1260 size_t count)
1261{
1262 struct nvme_ctrl *ctrl = dev_get_drvdata(dev);
1263
1264 nvme_queue_scan(ctrl);
1265 return count;
1266}
1267static DEVICE_ATTR(rescan_controller, S_IWUSR, NULL, nvme_sysfs_rescan);
1268
1242static ssize_t wwid_show(struct device *dev, struct device_attribute *attr, 1269static ssize_t wwid_show(struct device *dev, struct device_attribute *attr,
1243 char *buf) 1270 char *buf)
1244{ 1271{
@@ -1342,6 +1369,7 @@ nvme_show_int_function(cntlid);
1342 1369
1343static struct attribute *nvme_dev_attrs[] = { 1370static struct attribute *nvme_dev_attrs[] = {
1344 &dev_attr_reset_controller.attr, 1371 &dev_attr_reset_controller.attr,
1372 &dev_attr_rescan_controller.attr,
1345 &dev_attr_model.attr, 1373 &dev_attr_model.attr,
1346 &dev_attr_serial.attr, 1374 &dev_attr_serial.attr,
1347 &dev_attr_firmware_rev.attr, 1375 &dev_attr_firmware_rev.attr,
@@ -1580,6 +1608,15 @@ void nvme_remove_namespaces(struct nvme_ctrl *ctrl)
1580{ 1608{
1581 struct nvme_ns *ns, *next; 1609 struct nvme_ns *ns, *next;
1582 1610
1611 /*
1612 * The dead states indicates the controller was not gracefully
1613 * disconnected. In that case, we won't be able to flush any data while
1614 * removing the namespaces' disks; fail all the queues now to avoid
1615 * potentially having to clean up the failed sync later.
1616 */
1617 if (ctrl->state == NVME_CTRL_DEAD)
1618 nvme_kill_queues(ctrl);
1619
1583 mutex_lock(&ctrl->namespaces_mutex); 1620 mutex_lock(&ctrl->namespaces_mutex);
1584 list_for_each_entry_safe(ns, next, &ctrl->namespaces, list) 1621 list_for_each_entry_safe(ns, next, &ctrl->namespaces, list)
1585 nvme_ns_remove(ns); 1622 nvme_ns_remove(ns);
diff --git a/drivers/nvme/host/nvme.h b/drivers/nvme/host/nvme.h
index 114b92873894..1daa0482de0e 100644
--- a/drivers/nvme/host/nvme.h
+++ b/drivers/nvme/host/nvme.h
@@ -72,6 +72,7 @@ enum nvme_ctrl_state {
72 NVME_CTRL_LIVE, 72 NVME_CTRL_LIVE,
73 NVME_CTRL_RESETTING, 73 NVME_CTRL_RESETTING,
74 NVME_CTRL_DELETING, 74 NVME_CTRL_DELETING,
75 NVME_CTRL_DEAD,
75}; 76};
76 77
77struct nvme_ctrl { 78struct nvme_ctrl {
diff --git a/drivers/nvme/host/pci.c b/drivers/nvme/host/pci.c
index 0f093f14d348..78dca3193ca4 100644
--- a/drivers/nvme/host/pci.c
+++ b/drivers/nvme/host/pci.c
@@ -1394,7 +1394,7 @@ static int nvme_setup_io_queues(struct nvme_dev *dev)
1394 struct pci_dev *pdev = to_pci_dev(dev->dev); 1394 struct pci_dev *pdev = to_pci_dev(dev->dev);
1395 int result, i, vecs, nr_io_queues, size; 1395 int result, i, vecs, nr_io_queues, size;
1396 1396
1397 nr_io_queues = num_possible_cpus(); 1397 nr_io_queues = num_online_cpus();
1398 result = nvme_set_queue_count(&dev->ctrl, &nr_io_queues); 1398 result = nvme_set_queue_count(&dev->ctrl, &nr_io_queues);
1399 if (result < 0) 1399 if (result < 0)
1400 return result; 1400 return result;
@@ -1551,12 +1551,12 @@ static int nvme_delete_queue(struct nvme_queue *nvmeq, u8 opcode)
1551 1551
1552static void nvme_disable_io_queues(struct nvme_dev *dev) 1552static void nvme_disable_io_queues(struct nvme_dev *dev)
1553{ 1553{
1554 int pass; 1554 int pass, queues = dev->online_queues - 1;
1555 unsigned long timeout; 1555 unsigned long timeout;
1556 u8 opcode = nvme_admin_delete_sq; 1556 u8 opcode = nvme_admin_delete_sq;
1557 1557
1558 for (pass = 0; pass < 2; pass++) { 1558 for (pass = 0; pass < 2; pass++) {
1559 int sent = 0, i = dev->queue_count - 1; 1559 int sent = 0, i = queues;
1560 1560
1561 reinit_completion(&dev->ioq_wait); 1561 reinit_completion(&dev->ioq_wait);
1562 retry: 1562 retry:
@@ -1857,7 +1857,7 @@ static void nvme_remove_dead_ctrl_work(struct work_struct *work)
1857 1857
1858 nvme_kill_queues(&dev->ctrl); 1858 nvme_kill_queues(&dev->ctrl);
1859 if (pci_get_drvdata(pdev)) 1859 if (pci_get_drvdata(pdev))
1860 pci_stop_and_remove_bus_device_locked(pdev); 1860 device_release_driver(&pdev->dev);
1861 nvme_put_ctrl(&dev->ctrl); 1861 nvme_put_ctrl(&dev->ctrl);
1862} 1862}
1863 1863
@@ -2017,6 +2017,10 @@ static void nvme_remove(struct pci_dev *pdev)
2017 nvme_change_ctrl_state(&dev->ctrl, NVME_CTRL_DELETING); 2017 nvme_change_ctrl_state(&dev->ctrl, NVME_CTRL_DELETING);
2018 2018
2019 pci_set_drvdata(pdev, NULL); 2019 pci_set_drvdata(pdev, NULL);
2020
2021 if (!pci_device_is_present(pdev))
2022 nvme_change_ctrl_state(&dev->ctrl, NVME_CTRL_DEAD);
2023
2020 flush_work(&dev->reset_work); 2024 flush_work(&dev->reset_work);
2021 nvme_uninit_ctrl(&dev->ctrl); 2025 nvme_uninit_ctrl(&dev->ctrl);
2022 nvme_dev_disable(dev, true); 2026 nvme_dev_disable(dev, true);
@@ -2060,14 +2064,17 @@ static pci_ers_result_t nvme_error_detected(struct pci_dev *pdev,
2060 * shutdown the controller to quiesce. The controller will be restarted 2064 * shutdown the controller to quiesce. The controller will be restarted
2061 * after the slot reset through driver's slot_reset callback. 2065 * after the slot reset through driver's slot_reset callback.
2062 */ 2066 */
2063 dev_warn(dev->ctrl.device, "error detected: state:%d\n", state);
2064 switch (state) { 2067 switch (state) {
2065 case pci_channel_io_normal: 2068 case pci_channel_io_normal:
2066 return PCI_ERS_RESULT_CAN_RECOVER; 2069 return PCI_ERS_RESULT_CAN_RECOVER;
2067 case pci_channel_io_frozen: 2070 case pci_channel_io_frozen:
2071 dev_warn(dev->ctrl.device,
2072 "frozen state error detected, reset controller\n");
2068 nvme_dev_disable(dev, false); 2073 nvme_dev_disable(dev, false);
2069 return PCI_ERS_RESULT_NEED_RESET; 2074 return PCI_ERS_RESULT_NEED_RESET;
2070 case pci_channel_io_perm_failure: 2075 case pci_channel_io_perm_failure:
2076 dev_warn(dev->ctrl.device,
2077 "failure state error detected, request disconnect\n");
2071 return PCI_ERS_RESULT_DISCONNECT; 2078 return PCI_ERS_RESULT_DISCONNECT;
2072 } 2079 }
2073 return PCI_ERS_RESULT_NEED_RESET; 2080 return PCI_ERS_RESULT_NEED_RESET;
@@ -2102,6 +2109,12 @@ static const struct pci_device_id nvme_id_table[] = {
2102 { PCI_VDEVICE(INTEL, 0x0953), 2109 { PCI_VDEVICE(INTEL, 0x0953),
2103 .driver_data = NVME_QUIRK_STRIPE_SIZE | 2110 .driver_data = NVME_QUIRK_STRIPE_SIZE |
2104 NVME_QUIRK_DISCARD_ZEROES, }, 2111 NVME_QUIRK_DISCARD_ZEROES, },
2112 { PCI_VDEVICE(INTEL, 0x0a53),
2113 .driver_data = NVME_QUIRK_STRIPE_SIZE |
2114 NVME_QUIRK_DISCARD_ZEROES, },
2115 { PCI_VDEVICE(INTEL, 0x0a54),
2116 .driver_data = NVME_QUIRK_STRIPE_SIZE |
2117 NVME_QUIRK_DISCARD_ZEROES, },
2105 { PCI_VDEVICE(INTEL, 0x5845), /* Qemu emulated controller */ 2118 { PCI_VDEVICE(INTEL, 0x5845), /* Qemu emulated controller */
2106 .driver_data = NVME_QUIRK_IDENTIFY_CNS, }, 2119 .driver_data = NVME_QUIRK_IDENTIFY_CNS, },
2107 { PCI_DEVICE_CLASS(PCI_CLASS_STORAGE_EXPRESS, 0xffffff) }, 2120 { PCI_DEVICE_CLASS(PCI_CLASS_STORAGE_EXPRESS, 0xffffff) },
diff --git a/include/uapi/linux/nvme_ioctl.h b/include/uapi/linux/nvme_ioctl.h
index c4b2a3f90829..50ff21f748b6 100644
--- a/include/uapi/linux/nvme_ioctl.h
+++ b/include/uapi/linux/nvme_ioctl.h
@@ -61,5 +61,6 @@ struct nvme_passthru_cmd {
61#define NVME_IOCTL_IO_CMD _IOWR('N', 0x43, struct nvme_passthru_cmd) 61#define NVME_IOCTL_IO_CMD _IOWR('N', 0x43, struct nvme_passthru_cmd)
62#define NVME_IOCTL_RESET _IO('N', 0x44) 62#define NVME_IOCTL_RESET _IO('N', 0x44)
63#define NVME_IOCTL_SUBSYS_RESET _IO('N', 0x45) 63#define NVME_IOCTL_SUBSYS_RESET _IO('N', 0x45)
64#define NVME_IOCTL_RESCAN _IO('N', 0x46)
64 65
65#endif /* _UAPI_LINUX_NVME_IOCTL_H */ 66#endif /* _UAPI_LINUX_NVME_IOCTL_H */