Merge branch 'for-linus' of git://git.kernel.dk/linux-block
authorLinus Torvalds <torvalds@linux-foundation.org>
Sat, 20 May 2017 23:12:30 +0000 (16:12 -0700)
committerLinus Torvalds <torvalds@linux-foundation.org>
Sat, 20 May 2017 23:12:30 +0000 (16:12 -0700)
Pull block fixes from Jens Axboe:
 "A small collection of fixes that should go into this cycle.

   - a pull request from Christoph for NVMe, which ended up being
     manually applied to avoid pulling in newer bits in master. Mostly
     fibre channel fixes from James, but also a few fixes from Jon and
     Vijay

   - a pull request from Konrad, with just a single fix for xen-blkback
     from Gustavo.

   - a fuseblk bdi fix from Jan, fixing a regression in this series with
     the dynamic backing devices.

   - a blktrace fix from Shaohua, replacing sscanf() with kstrtoull().

   - a request leak fix for drbd from Lars, fixing a regression in the
     last series with the kref changes. This will go to stable as well"

* 'for-linus' of git://git.kernel.dk/linux-block:
  nvmet: release the sq ref on rdma read errors
  nvmet-fc: remove target cpu scheduling flag
  nvme-fc: stop queues on error detection
  nvme-fc: require target or discovery role for fc-nvme targets
  nvme-fc: correct port role bits
  nvme: unmap CMB and remove sysfs file in reset path
  blktrace: fix integer parse
  fuseblk: Fix warning in super_setup_bdi_name()
  block: xen-blkback: add null check to avoid null pointer dereference
  drbd: fix request leak introduced by locking/atomic, kref: Kill kref_sub()

1  2 
drivers/nvme/host/pci.c
fs/fuse/inode.c

diff --combined drivers/nvme/host/pci.c
index fed803232edccbdf63139d89028c694efff52409,0866f64890e5a864cdbb1cca4d253ad01289a122..4c2ff2bb26bcd7c615e40ae777327a3ba401cf3d
@@@ -132,6 -132,7 +132,6 @@@ static inline struct nvme_dev *to_nvme_
  struct nvme_queue {
        struct device *q_dmadev;
        struct nvme_dev *dev;
 -      char irqname[24];       /* nvme4294967295-65535\0 */
        spinlock_t q_lock;
        struct nvme_command *sq_cmds;
        struct nvme_command __iomem *sq_cmds_io;
@@@ -328,6 -329,11 +328,6 @@@ static unsigned int nvme_cmd_size(struc
                nvme_iod_alloc_size(dev, NVME_INT_BYTES(dev), NVME_INT_PAGES);
  }
  
 -static int nvmeq_irq(struct nvme_queue *nvmeq)
 -{
 -      return pci_irq_vector(to_pci_dev(nvmeq->dev->dev), nvmeq->cq_vector);
 -}
 -
  static int nvme_admin_init_hctx(struct blk_mq_hw_ctx *hctx, void *data,
                                unsigned int hctx_idx)
  {
@@@ -1072,7 -1078,7 +1072,7 @@@ static int nvme_suspend_queue(struct nv
                spin_unlock_irq(&nvmeq->q_lock);
                return 1;
        }
 -      vector = nvmeq_irq(nvmeq);
 +      vector = nvmeq->cq_vector;
        nvmeq->dev->online_queues--;
        nvmeq->cq_vector = -1;
        spin_unlock_irq(&nvmeq->q_lock);
        if (!nvmeq->qid && nvmeq->dev->ctrl.admin_q)
                blk_mq_stop_hw_queues(nvmeq->dev->ctrl.admin_q);
  
 -      free_irq(vector, nvmeq);
 +      pci_free_irq(to_pci_dev(nvmeq->dev->dev), vector, nvmeq);
  
        return 0;
  }
@@@ -1165,6 -1171,8 +1165,6 @@@ static struct nvme_queue *nvme_alloc_qu
  
        nvmeq->q_dmadev = dev->dev;
        nvmeq->dev = dev;
 -      snprintf(nvmeq->irqname, sizeof(nvmeq->irqname), "nvme%dq%d",
 -                      dev->ctrl.instance, qid);
        spin_lock_init(&nvmeq->q_lock);
        nvmeq->cq_head = 0;
        nvmeq->cq_phase = 1;
  
  static int queue_request_irq(struct nvme_queue *nvmeq)
  {
 -      if (use_threaded_interrupts)
 -              return request_threaded_irq(nvmeq_irq(nvmeq), nvme_irq_check,
 -                              nvme_irq, IRQF_SHARED, nvmeq->irqname, nvmeq);
 -      else
 -              return request_irq(nvmeq_irq(nvmeq), nvme_irq, IRQF_SHARED,
 -                              nvmeq->irqname, nvmeq);
 +      struct pci_dev *pdev = to_pci_dev(nvmeq->dev->dev);
 +      int nr = nvmeq->dev->ctrl.instance;
 +
 +      if (use_threaded_interrupts) {
 +              return pci_request_irq(pdev, nvmeq->cq_vector, nvme_irq_check,
 +                              nvme_irq, nvmeq, "nvme%dq%d", nr, nvmeq->qid);
 +      } else {
 +              return pci_request_irq(pdev, nvmeq->cq_vector, nvme_irq,
 +                              NULL, nvmeq, "nvme%dq%d", nr, nvmeq->qid);
 +      }
  }
  
  static void nvme_init_queue(struct nvme_queue *nvmeq, u16 qid)
@@@ -1506,6 -1510,11 +1506,11 @@@ static inline void nvme_release_cmb(str
        if (dev->cmb) {
                iounmap(dev->cmb);
                dev->cmb = NULL;
+               if (dev->cmbsz) {
+                       sysfs_remove_file_from_group(&dev->ctrl.device->kobj,
+                                                    &dev_attr_cmb.attr, NULL);
+                       dev->cmbsz = 0;
+               }
        }
  }
  
@@@ -1553,7 -1562,7 +1558,7 @@@ static int nvme_setup_io_queues(struct 
        }
  
        /* Deregister the admin queue's interrupt */
 -      free_irq(pci_irq_vector(pdev, 0), adminq);
 +      pci_free_irq(pdev, 0, adminq);
  
        /*
         * If we enable msix early due to not intx, disable it again before
@@@ -1779,6 -1788,7 +1784,7 @@@ static void nvme_pci_disable(struct nvm
  {
        struct pci_dev *pdev = to_pci_dev(dev->dev);
  
+       nvme_release_cmb(dev);
        pci_free_irq_vectors(pdev);
  
        if (pci_is_enabled(pdev)) {
@@@ -2184,7 -2194,6 +2190,6 @@@ static void nvme_remove(struct pci_dev 
        nvme_dev_disable(dev, true);
        nvme_dev_remove_admin(dev);
        nvme_free_queues(dev, 0);
-       nvme_release_cmb(dev);
        nvme_release_prp_pools(dev);
        nvme_dev_unmap(dev);
        nvme_put_ctrl(&dev->ctrl);
diff --combined fs/fuse/inode.c
index 5a1b58f8fef4d2437842b73d4c1c12b2e87a32c9,9da1a61276d199545a3863f9479e849ff48fe70b..65c88379a3a14311cca68b8750d6bb0b9f107444
@@@ -21,7 -21,6 +21,7 @@@
  #include <linux/sched.h>
  #include <linux/exportfs.h>
  #include <linux/posix_acl.h>
 +#include <linux/pid_namespace.h>
  
  MODULE_AUTHOR("Miklos Szeredi <miklos@szeredi.hu>");
  MODULE_DESCRIPTION("Filesystem in Userspace");
@@@ -602,7 -601,7 +602,7 @@@ void fuse_conn_init(struct fuse_conn *f
        memset(fc, 0, sizeof(*fc));
        spin_lock_init(&fc->lock);
        init_rwsem(&fc->killsb);
 -      atomic_set(&fc->count, 1);
 +      refcount_set(&fc->count, 1);
        atomic_set(&fc->dev_count, 1);
        init_waitqueue_head(&fc->blocked_waitq);
        init_waitqueue_head(&fc->reserved_req_waitq);
        fc->connected = 1;
        fc->attr_version = 1;
        get_random_bytes(&fc->scramble_key, sizeof(fc->scramble_key));
 +      fc->pid_ns = get_pid_ns(task_active_pid_ns(current));
  }
  EXPORT_SYMBOL_GPL(fuse_conn_init);
  
  void fuse_conn_put(struct fuse_conn *fc)
  {
 -      if (atomic_dec_and_test(&fc->count)) {
 +      if (refcount_dec_and_test(&fc->count)) {
                if (fc->destroy_req)
                        fuse_request_free(fc->destroy_req);
 +              put_pid_ns(fc->pid_ns);
                fc->release(fc);
        }
  }
@@@ -637,7 -634,7 +637,7 @@@ EXPORT_SYMBOL_GPL(fuse_conn_put)
  
  struct fuse_conn *fuse_conn_get(struct fuse_conn *fc)
  {
 -      atomic_inc(&fc->count);
 +      refcount_inc(&fc->count);
        return fc;
  }
  EXPORT_SYMBOL_GPL(fuse_conn_get);
@@@ -975,8 -972,15 +975,15 @@@ static int fuse_bdi_init(struct fuse_co
        int err;
        char *suffix = "";
  
-       if (sb->s_bdev)
+       if (sb->s_bdev) {
                suffix = "-fuseblk";
+               /*
+                * sb->s_bdi points to blkdev's bdi however we want to redirect
+                * it to our private bdi...
+                */
+               bdi_put(sb->s_bdi);
+               sb->s_bdi = &noop_backing_dev_info;
+       }
        err = super_setup_bdi_name(sb, "%u:%u%s", MAJOR(fc->dev),
                                   MINOR(fc->dev), suffix);
        if (err)