Merge tag 'for-linus-2019-08-17' of git://git.kernel.dk/linux-block
authorLinus Torvalds <torvalds@linux-foundation.org>
Sun, 18 Aug 2019 02:39:54 +0000 (19:39 -0700)
committerLinus Torvalds <torvalds@linux-foundation.org>
Sun, 18 Aug 2019 02:39:54 +0000 (19:39 -0700)
Pull block fixes from Jens Axboe:
 "A collection of fixes that should go into this series. This contains:

   - Revert of the REQ_NOWAIT_INLINE and associated dio changes. There
     were still corner cases there, and even though I had a solution for
     it, it's too involved for this stage. (me)

   - Set of NVMe fixes (via Sagi)

   - io_uring fix for fixed buffers (Anthony)

   - io_uring defer issue fix (Jackie)

   - Regression fix for queue sync at exit time (zhengbin)

   - xen blk-back memory leak fix (Wenwen)"

* tag 'for-linus-2019-08-17' of git://git.kernel.dk/linux-block:
  io_uring: fix an issue when IOSQE_IO_LINK is inserted into defer list
  block: remove REQ_NOWAIT_INLINE
  io_uring: fix manual setup of iov_iter for fixed buffers
  xen/blkback: fix memory leaks
  blk-mq: move cancel of requeue_work to the front of blk_exit_queue
  nvme-pci: Fix async probe remove race
  nvme: fix controller removal race with scan work
  nvme-rdma: fix possible use-after-free in connect error flow
  nvme: fix a possible deadlock when passthru commands sent to a multipath device
  nvme-core: Fix extra device_put() call on error path
  nvmet-file: fix nvmet_file_flush() always returning an error
  nvmet-loop: Flush nvme_delete_wq when removing the port
  nvmet: Fix use-after-free bug when a port is removed
  nvme-multipath: revalidate nvme_ns_head gendisk in nvme_validate_ns

1  2 
drivers/nvme/host/pci.c

diff --combined drivers/nvme/host/pci.c
index 108e109e99f1aceddce3c535c3e25079752204bf,0c2c4b0c665598e8f899503fdfb5e957f9ad442c..6bd9b10339654b3d11aa3944f7a51ee264ffb8a2
@@@ -2695,7 -2695,7 +2695,7 @@@ static void nvme_async_probe(void *data
  {
        struct nvme_dev *dev = data;
  
-       nvme_reset_ctrl_sync(&dev->ctrl);
+       flush_work(&dev->ctrl.reset_work);
        flush_work(&dev->ctrl.scan_work);
        nvme_put_ctrl(&dev->ctrl);
  }
@@@ -2761,6 -2761,7 +2761,7 @@@ static int nvme_probe(struct pci_dev *p
  
        dev_info(dev->ctrl.device, "pci function %s\n", dev_name(&pdev->dev));
  
+       nvme_reset_ctrl(&dev->ctrl);
        nvme_get_ctrl(&dev->ctrl);
        async_schedule(nvme_async_probe, dev);
  
@@@ -2846,7 -2847,7 +2847,7 @@@ static int nvme_resume(struct device *d
        struct nvme_dev *ndev = pci_get_drvdata(to_pci_dev(dev));
        struct nvme_ctrl *ctrl = &ndev->ctrl;
  
 -      if (pm_resume_via_firmware() || !ctrl->npss ||
 +      if (ndev->last_ps == U32_MAX ||
            nvme_set_power_state(ctrl, ndev->last_ps) != 0)
                nvme_reset_ctrl(ctrl);
        return 0;
@@@ -2859,8 -2860,6 +2860,8 @@@ static int nvme_suspend(struct device *
        struct nvme_ctrl *ctrl = &ndev->ctrl;
        int ret = -EBUSY;
  
 +      ndev->last_ps = U32_MAX;
 +
        /*
         * The platform does not remove power for a kernel managed suspend so
         * use host managed nvme power settings for lowest idle power if
         * shutdown.  But if the firmware is involved after the suspend or the
         * device does not support any non-default power states, shut down the
         * device fully.
 +       *
 +       * If ASPM is not enabled for the device, shut down the device and allow
 +       * the PCI bus layer to put it into D3 in order to take the PCIe link
 +       * down, so as to allow the platform to achieve its minimum low-power
 +       * state (which may not be possible if the link is up).
         */
 -      if (pm_suspend_via_firmware() || !ctrl->npss) {
 +      if (pm_suspend_via_firmware() || !ctrl->npss ||
 +          !pcie_aspm_enabled(pdev)) {
                nvme_dev_disable(ndev, true);
                return 0;
        }
            ctrl->state != NVME_CTRL_ADMIN_ONLY)
                goto unfreeze;
  
 -      ndev->last_ps = 0;
        ret = nvme_get_power_state(ctrl, &ndev->last_ps);
        if (ret < 0)
                goto unfreeze;