1. 28 Apr, 2017 3 commits
  2. 27 Apr, 2017 2 commits
    • Jens Axboe's avatar
      blk-mq-sched: alloate reserved tags out of normal pool · 33931808
      Jens Axboe authored
      At least one driver, mtip32xx, has a hard coded dependency on
      the value of the reserved tag used for internal commands. While
      that should really be fixed up, for now let's ensure that we just
      bypass the scheduler tags an allocation marked as reserved. They
      are used for house keeping or error handling, so we can safely
      ignore them in the scheduler.
      Tested-by: default avatarMing Lei <ming.lei@redhat.com>
      Signed-off-by: default avatarJens Axboe <axboe@fb.com>
      33931808
    • Ming Lei's avatar
      mtip32xx: use runtime tag to initialize command header · a4e84aae
      Ming Lei authored
      mtip32xx supposes that 'request_idx' passed to .init_request()
      is tag of the request, and use that as request's tag to initialize
      command header.
      
      After MQ IO scheduler is in, request tag assigned isn't same with
      the request index anymore, so cause strange hardware failure on
      mtip32xx, even whole system panic is triggered.
      
      This patch fixes the issue by initializing command header via
      request's real tag.
      Signed-off-by: default avatarMing Lei <ming.lei@redhat.com>
      Signed-off-by: default avatarJens Axboe <axboe@fb.com>
      a4e84aae
  3. 26 Apr, 2017 13 commits
  4. 25 Apr, 2017 2 commits
  5. 23 Apr, 2017 6 commits
  6. 21 Apr, 2017 14 commits
    • Dan Carpenter's avatar
      lightnvm: don't print a warning for ADDR_EMPTY · 659226eb
      Dan Carpenter authored
      Reading from ADDR_EMPTY is out of bounds.  The current code generates a
      static checker warning because we check for out of bounds "lba" before
      we check for ADDR_EMPTY, so the second check is always false.  It looks
      like we intended ADDR_EMPTY to be a no-op without printing a warning.
      
      Fixes: a4bd217b ("lightnvm: physical block device (pblk) target")
      Signed-off-by: default avatarDan Carpenter <dan.carpenter@oracle.com>
      Reviewed-by: default avatarJavier González <javier@cnexlabs.com>
      Signed-off-by: default avatarJens Axboe <axboe@fb.com>
      659226eb
    • Dan Carpenter's avatar
      lightnvm: potential underflow in pblk_read_rq() · 5bf1e1ee
      Dan Carpenter authored
      This is a static checker fix, and perhaps not a real bug.  The static
      checker thinks that nr_secs could be negative.  It would result in
      zeroing more memory than intended.  Anyway, even if it's not a bug,
      changing this variable to unsigned makes the code easier to audit.
      
      Fixes: a4bd217b ("lightnvm: physical block device (pblk) target")
      Signed-off-by: default avatarDan Carpenter <dan.carpenter@oracle.com>
      Reviewed-by: default avatarJavier González <javier@cnexlabs.com>
      Signed-off-by: default avatarJens Axboe <axboe@fb.com>
      5bf1e1ee
    • Ilya Dryomov's avatar
      block: get rid of blk_integrity_revalidate() · 19b7ccf8
      Ilya Dryomov authored
      Commit 25520d55 ("block: Inline blk_integrity in struct gendisk")
      introduced blk_integrity_revalidate(), which seems to assume ownership
      of the stable pages flag and unilaterally clears it if no blk_integrity
      profile is registered:
      
          if (bi->profile)
                  disk->queue->backing_dev_info->capabilities |=
                          BDI_CAP_STABLE_WRITES;
          else
                  disk->queue->backing_dev_info->capabilities &=
                          ~BDI_CAP_STABLE_WRITES;
      
      It's called from revalidate_disk() and rescan_partitions(), making it
      impossible to enable stable pages for drivers that support partitions
      and don't use blk_integrity: while the call in revalidate_disk() can be
      trivially worked around (see zram, which doesn't support partitions and
      hence gets away with zram_revalidate_disk()), rescan_partitions() can
      be triggered from userspace at any time.  This breaks rbd, where the
      ceph messenger is responsible for generating/verifying CRCs.
      
      Since blk_integrity_{un,}register() "must" be used for (un)registering
      the integrity profile with the block layer, move BDI_CAP_STABLE_WRITES
      setting there.  This way drivers that call blk_integrity_register() and
      use integrity infrastructure won't interfere with drivers that don't
      but still want stable pages.
      
      Fixes: 25520d55 ("block: Inline blk_integrity in struct gendisk")
      Cc: "Martin K. Petersen" <martin.petersen@oracle.com>
      Cc: Christoph Hellwig <hch@lst.de>
      Cc: Mike Snitzer <snitzer@redhat.com>
      Cc: stable@vger.kernel.org # 4.4+, needs backporting
      Tested-by: default avatarDan Williams <dan.j.williams@intel.com>
      Signed-off-by: default avatarIlya Dryomov <idryomov@gmail.com>
      Signed-off-by: default avatarJens Axboe <axboe@fb.com>
      19b7ccf8
    • Rakesh Pandit's avatar
      lightnvm: propagate pblk_init return to userspace · 8d77bb82
      Rakesh Pandit authored
      From userspace calling ioctl(NVM_DEV_CREATE) was returning ENOMEM for
      invalid arguments even though pblk (pblk_init) was returning correctly
      -EINVAL to nvm_create_tgt inside core.  This patch propagates the
      correct return value to userspace.
      
      Because pblk was introduced recently this only needs to go in 4.12.
      
      Fixes: a4bd217b ("lightnvm: physical block device (pblk) target")
      Signed-off-by: default avatarRakesh Pandit <rakesh@tuxera.com>
      Signed-off-by: default avatarJens Axboe <axboe@fb.com>
      8d77bb82
    • Bart Van Assche's avatar
      blk-mq: Fix preempt count imbalance · abc25a69
      Bart Van Assche authored
      Avoid that the following kernel bug gets triggered:
      
      BUG: sleeping function called from invalid context at ./include/linux/buffer_head.h:349
      in_atomic(): 1, irqs_disabled(): 0, pid: 8019, name: find
      CPU: 10 PID: 8019 Comm: find Tainted: G        W I     4.11.0-rc4-dbg+ #2
      Call Trace:
       dump_stack+0x68/0x93
       ___might_sleep+0x16e/0x230
       __might_sleep+0x4a/0x80
       __ext4_get_inode_loc+0x1e0/0x4e0
       ext4_iget+0x70/0xbc0
       ext4_iget_normal+0x2f/0x40
       ext4_lookup+0xb6/0x1f0
       lookup_slow+0x104/0x1e0
       walk_component+0x19a/0x330
       path_lookupat+0x4b/0x100
       filename_lookup+0x9a/0x110
       user_path_at_empty+0x36/0x40
       vfs_statx+0x67/0xc0
       SYSC_newfstatat+0x20/0x40
       SyS_newfstatat+0xe/0x10
       entry_SYSCALL_64_fastpath+0x18/0xad
      
      This happens since the big if/else in blk_mq_make_request() doesn't
      have final else section that also drops the ctx. Add that.
      
      Fixes: b00c53e8 ("blk-mq: fix schedule-while-atomic with scheduler attached")
      Signed-off-by: default avatarBart Van Assche <bart.vanassche@sandisk.com>
      Cc: Omar Sandoval <osandov@fb.com>
      
      Added a bit more to the commit log.
      Signed-off-by: default avatarJens Axboe <axboe@fb.com>
      abc25a69
    • Jens Axboe's avatar
      Merge branch 'nvme-4.12' of git://git.infradead.org/nvme into for-4.12/block · f8a05a1d
      Jens Axboe authored
      Christoph writes:
      
      This is the current NVMe pile: virtualization extensions, lots of FC
      updates and various misc bits.  There are a few more FC bits that didn't
      make the cut, but we'd like to get this request out before the merge
      window for sure.
      f8a05a1d
    • Jens Axboe's avatar
      mtip32xx: fix dereference of stack garbage · 95c55ff4
      Jens Axboe authored
      We need to get the command payload from the request before
      we attempt to dereference it.
      
      Fixes: 4dda4735 ("mtip32xx: add a status field to struct mtip_cmd")
      Reviewed-by: default avatarChristoph Hellwig <hch@lst.de>
      Signed-off-by: default avatarJens Axboe <axboe@fb.com>
      95c55ff4
    • Junxiong Guan's avatar
      nvme: let dm-mpath distinguish nvme error codes · e02ab023
      Junxiong Guan authored
      Currently most IOs which return the nvme error codes are retried on
      the other path if those IOs returns EIO from NVMe driver. This
      patch let Multipath distinguish nvme media error codes and some
      generic or cmd-specific nvme error codes so that multipath will
      not retry those kinds of IO, to save bandwidth.
      Signed-off-by: default avatarJunxiong Guan <guanjunxiong@huawei.com>
      Signed-off-by: default avatarChristoph Hellwig <hch@lst.de>
      e02ab023
    • Keith Busch's avatar
      nvme/pci: Poll CQ on timeout · 7776db1c
      Keith Busch authored
      If an IO timeout occurs, it's helpful to know if the controller did not
      post a completion or the driver missed an interrupt. While we never expect
      the latter, this patch will make it possible to tell the difference so
      we don't have to guess.
      Signed-off-by: default avatarKeith Busch <keith.busch@intel.com>
      Signed-off-by: default avatarChristoph Hellwig <hch@lst.de>
      Tested-by: default avatarJohannes Thumshirn <jthumshirn@suse.de>
      Reviewed-by: default avatarJohannes Thumshirn <jthumshirn@suse.de>
      7776db1c
    • James Smart's avatar
      nvmet_fc: Change traddr field separator to a colon · 43631357
      James Smart authored
      The FC-NVME spec revised syntax to avoid comma separators.
      Sync with the change in the parser for traddr on port attachments.
      Signed-off-by: default avatarJames Smart <james.smart@broadcom.com>
      Signed-off-by: default avatarSagi Grimberg <sagi@grimberg.me>
      43631357
    • James Smart's avatar
      nvme_fc: Add ls aborts on remote port teardown · 8d64daf7
      James Smart authored
      remoteport teardown never aborted the LS opertions. Add support.
      Signed-off-by: default avatarJames Smart <james.smart@broadcom.com>
      Signed-off-by: default avatarSagi Grimberg <sagi@grimberg.me>
      8d64daf7
    • James Smart's avatar
      nvme_fc: Move LS's to rport · c913a8b0
      James Smart authored
      Link LS's on the remoteport rather than the controller. LS's are
      between nport's. Makes more sense, especially on async teardown where
      the controller is torn down regardless of the LS (LS is more of a notifier
      to the target of the teardown), to have them on the remoteport.
      
      While revising ls send/done routines, issues were seen relative to
      refcounting and cleanup, especially in async path. Reworked these code
      paths.
      Signed-off-by: default avatarJames Smart <james.smart@broadcom.com>
      Signed-off-by: default avatarSagi Grimberg <sagi@grimberg.me>
      c913a8b0
    • James Smart's avatar
      nvmet_fc: add missing reference in add_port · 568ad51e
      James Smart authored
      Add missing reference in add_port
      Signed-off-by: default avatarJames Smart <james.smart@broadcom.com>
      Signed-off-by: default avatarSagi Grimberg <sagi@grimberg.me>
      568ad51e
    • James Smart's avatar
      nvmet_fc: Rework target side abort handling · a97ec51b
      James Smart authored
      target transport:
      ----------------------
      There are cases when there is a need to abort in-progress target
      operations (writedata) so that controller termination or errors can
      clean up. That can't happen currently as the abort is another target
      op type, so it can't be used till the running one finishes (and it may
      not).  Solve by removing the abort op type and creating a separate
      downcall from the transport to the lldd to request an io to be aborted.
      
      The transport will abort ios on queue teardown or io errors. In general
      the transport tries to call the lldd abort only when the io state is
      idle. Meaning: ops that transmit data (readdata or rsp) will always
      finish their transmit (or the lldd will see a state on the
      link or initiator port that fails the transmit) and the done call for
      the operation will occur. The transport will wait for the op done
      upcall before calling the abort function, and as the io is idle, the
      io can be cleaned up immediately after the abort call; Similarly, ios
      that are not waiting for data or transmitting data must be in the nvmet
      layer being processed. The transport will wait for the nvmet layer
      completion before calling the abort function, and as the io is idle,
      the io can be cleaned up immediately after the abort call; As for ops
      that are waiting for data (writedata), they may be outstanding
      indefinitely if the lldd doesn't see a condition where the initiatior
      port or link is bad. In those cases, the transport will call the abort
      function and wait for the lldd's op done upcall for the operation, where
      it will then clean up the io.
      
      Additionally, if a lldd receives an ABTS and matches it to an outstanding
      request in the transport, A new new transport upcall was created to abort
      the outstanding request in the transport. The transport expects any
      outstanding op call (readdata or writedata) will completed by the lldd and
      the operation upcall made. The transport doesn't act on the reported
      abort (e.g. clean up the io) until an op done upcall occurs, a new op is
      attempted, or the nvmet layer completes the io processing.
      
      fcloop:
      ----------------------
      Updated to support the new target apis.
      On fcp io aborts from the initiator, the loopback context is updated to
      NULL out the half that has completed. The initiator side is immediately
      called after the abort request with an io completion (abort status).
      On fcp io aborts from the target, the io is stopped and the initiator side
      sees it as an aborted io. Target side ops, perhaps in progress while the
      initiator side is done, continue but noop the data movement as there's no
      structure on the initiator side to reference.
      
      patch also contains:
      ----------------------
      Revised lpfc to support the new abort api
      
      commonized rsp buffer syncing and nulling of private data based on
      calling paths.
      
      errors in op done calls don't take action on the fod. They're bad
      operations which implies the fod may be bad.
      Signed-off-by: default avatarJames Smart <james.smart@broadcom.com>
      Signed-off-by: default avatarSagi Grimberg <sagi@grimberg.me>
      a97ec51b