History

Merge branch 'for-linus' of git://git.kernel.dk/linux-block

Pull block fixes from Jens Axboe: "A few fixes for the current series. This contains: - Two fixes for NVMe: One fixes a reset race that can be triggered by repeated insert/removal of the module. The other fixes an issue on some platforms, where we get probe timeouts since legacy interrupts isn't working. This used not to be a problem since we had the worker thread poll for completions, but since that was killed off, it means those poor souls can't successfully probe their NVMe device. Use a proper IRQ check and probe (msi-x -> msi ->legacy), like most other drivers to work around this. Both from Keith. - A loop corruption issue with offset in iters, from Ming Lei. - A fix for not having the partition stat per cpu ref count initialized before sending out the KOBJ_ADD, which could cause user space to access the counter prior to initialization. Also from Ming Lei. - A fix for using the wrong congestion state, from Kaixu Xia" * 'for-linus' of git://git.kernel.dk/linux-block: block: loop: fix filesystem corruption in case of aio/dio NVMe: Always use MSI/MSI-x interrupts NVMe: Fix reset/remove race writeback: fix the wrong congested state variable definition block: partition: initialize percpuref before sending out KOBJ_ADD

Linus Torvalds committed 10 years ago

Commit 2e572592 parents f3c9a1a a7297a64 files · +37 −17Browse files

Unified · Split

4 files
  1. block/partition-generic.c +10 −3
  2. drivers/block/loop.c +6 −0
  3. drivers/nvme/host/pci.c +19 −12
  4. mm/backing-dev.c +2 −2
block/partition-generic.c+10−3
@@ -361,15 +361,20 @@ struct hd_struct *add_partition(struct gendisk *disk, int partno, · 360 unmodified lines
361361 goto out_del;
362362 }
363363
364+ err = hd_ref_init(p);
365+ if (err) {
366+ if (flags & ADDPART_FLAG_WHOLEDISK)
367+ goto out_remove_file;
368+ goto out_del;
369+ }
370+
364371 /* everything is up and running, commence */
365372 rcu_assign_pointer(ptbl->part[partno], p);
366373
367374 /* suppress uevent if the disk suppresses it */
368375 if (!dev_get_uevent_suppress(ddev))
369376 kobject_uevent(&pdev->kobj, KOBJ_ADD);
370−
371− if (!hd_ref_init(p))
372− return p;
377+ return p;
373378
374379 out_free_info:
375380 free_part_info(p);
@@ -378,6 +383,8 @@ out_free_stats: · 2 unmodified lines
378383 out_free:
379384 kfree(p);
380385 return ERR_PTR(err);
386+out_remove_file:
387+ device_remove_file(pdev, &dev_attr_whole_disk);
381388 out_del:
382389 kobject_put(p->holder_dir);
383390 device_del(pdev);
drivers/block/loop.c+6−0
@@ -488,6 +488,12 @@ static int lo_rw_aio(struct loop_device *lo, struct loop_cmd *cmd, · 487 unmodified lines
488488 bvec = __bvec_iter_bvec(bio->bi_io_vec, bio->bi_iter);
489489 iov_iter_bvec(&iter, ITER_BVEC | rw, bvec,
490490 bio_segments(bio), blk_rq_bytes(cmd->rq));
491+ /*
492+ * This bio may be started from the middle of the 'bvec'
493+ * because of bio splitting, so offset from the bvec must
494+ * be passed to iov iterator
495+ */
496+ iter.iov_offset = bio->bi_iter.bi_bvec_done;
491497
492498 cmd->iocb.ki_pos = pos;
493499 cmd->iocb.ki_filp = file;
drivers/nvme/host/pci.c+19−12
@@ -1478,8 +1478,7 @@ static int nvme_setup_io_queues(struct nvme_dev *dev) · 1477 unmodified lines
14781478 if (result > 0) {
14791479 dev_err(dev->ctrl.device,
14801480 "Could not set queue count (%d)\n", result);
1481− nr_io_queues = 0;
1482− result = 0;
1481+ return 0;
14831482 }
14841483
14851484 if (dev->cmb && NVME_CMB_SQS(dev->cmbsz)) {
@@ -1513,7 +1512,9 @@ static int nvme_setup_io_queues(struct nvme_dev *dev) · 27 unmodified lines
15131512 * If we enable msix early due to not intx, disable it again before
15141513 * setting up the full range we need.
15151514 */
1516− if (!pdev->irq)
1515+ if (pdev->msi_enabled)
1516+ pci_disable_msi(pdev);
1517+ else if (pdev->msix_enabled)
15171518 pci_disable_msix(pdev);
15181519
15191520 for (i = 0; i < nr_io_queues; i++)
@@ -1696,7 +1697,6 @@ static int nvme_pci_enable(struct nvme_dev *dev) · 176 unmodified lines
16961697 if (pci_enable_device_mem(pdev))
16971698 return result;
16981699
1699− dev->entry[0].vector = pdev->irq;
17001700 pci_set_master(pdev);
17011701
17021702 if (dma_set_mask_and_coherent(dev->dev, DMA_BIT_MASK(64)) &&
@@ -1709,13 +1709,18 @@ static int nvme_pci_enable(struct nvme_dev *dev) · 6 unmodified lines
17091709 }
17101710
17111711 /*
1712− * Some devices don't advertse INTx interrupts, pre-enable a single
1713− * MSIX vec for setup. We'll adjust this later.
1712+ * Some devices and/or platforms don't advertise or work with INTx
1713+ * interrupts. Pre-enable a single MSIX or MSI vec for setup. We'll
1714+ * adjust this later.
17141715 */
1715− if (!pdev->irq) {
1716− result = pci_enable_msix(pdev, dev->entry, 1);
1717− if (result < 0)
1718− goto disable;
1716+ if (pci_enable_msix(pdev, dev->entry, 1)) {
1717+ pci_enable_msi(pdev);
1718+ dev->entry[0].vector = pdev->irq;
1719+ }
1720+
1721+ if (!dev->entry[0].vector) {
1722+ result = -ENODEV;
1723+ goto disable;
17191724 }
17201725
17211726 cap = lo_hi_readq(dev->bar + NVME_REG_CAP);
@@ -1859,6 +1864,9 @@ static void nvme_reset_work(struct work_struct *work) · 137 unmodified lines
18591864 if (dev->ctrl.ctrl_config & NVME_CC_ENABLE)
18601865 nvme_dev_disable(dev, false);
18611866
1867+ if (test_bit(NVME_CTRL_REMOVING, &dev->flags))
1868+ goto out;
1869+
18621870 set_bit(NVME_CTRL_RESETTING, &dev->flags);
18631871
18641872 result = nvme_pci_enable(dev);
@@ -2078,11 +2086,10 @@ static void nvme_remove(struct pci_dev *pdev) · 213 unmodified lines
20782086 {
20792087 struct nvme_dev *dev = pci_get_drvdata(pdev);
20802088
2081− del_timer_sync(&dev->watchdog_timer);
2082−
20832089 set_bit(NVME_CTRL_REMOVING, &dev->flags);
20842090 pci_set_drvdata(pdev, NULL);
20852091 flush_work(&dev->async_work);
2092+ flush_work(&dev->reset_work);
20862093 flush_work(&dev->scan_work);
20872094 nvme_remove_namespaces(&dev->ctrl);
20882095 nvme_uninit_ctrl(&dev->ctrl);
mm/backing-dev.c+2−2
@@ -898,7 +898,7 @@ static atomic_t nr_wb_congested[2]; · 897 unmodified lines
898898 void clear_wb_congested(struct bdi_writeback_congested *congested, int sync)
899899 {
900900 wait_queue_head_t *wqh = &congestion_wqh[sync];
901− enum wb_state bit;
901+ enum wb_congested_state bit;
902902
903903 bit = sync ? WB_sync_congested : WB_async_congested;
904904 if (test_and_clear_bit(bit, &congested->state))
@@ -911,7 +911,7 @@ EXPORT_SYMBOL(clear_wb_congested); · 6 unmodified lines
911911
912912 void set_wb_congested(struct bdi_writeback_congested *congested, int sync)
913913 {
914− enum wb_state bit;
914+ enum wb_congested_state bit;
915915
916916 bit = sync ? WB_sync_congested : WB_async_congested;
917917 if (!test_and_set_bit(bit, &congested->state))

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t