1. 03 Nov, 2021 1 commit
  2. 02 Nov, 2021 12 commits
  3. 30 Oct, 2021 4 commits
  4. 29 Oct, 2021 4 commits
  5. 28 Oct, 2021 1 commit
  6. 27 Oct, 2021 4 commits
  7. 25 Oct, 2021 1 commit
    • Michael Schmitz's avatar
      block: ataflop: more blk-mq refactoring fixes · d28e4dff
      Michael Schmitz authored
      As it turns out, my earlier patch in commit 86d46fda (block:
      ataflop: fix breakage introduced at blk-mq refactoring) was
      incomplete. This patch fixes any remaining issues found during
      more testing and code review.
      
      Requests exceeding 4 k are handled in 4k segments but
      __blk_mq_end_request() is never called on these (still
      sectors outstanding on the request). With redo_fd_request()
      removed, there is no provision to kick off processing of the
      next segment, causing requests exceeding 4k to hang. (By
      setting /sys/block/fd0/queue/max_sectors_k <= 4 as workaround,
      this behaviour can be avoided).
      
      Instead of reintroducing redo_fd_request(), requeue the remainder
      of the request by calling blk_mq_requeue_request() on incomplete
      requests (i.e. when blk_update_request() still returns true), and
      rely on the block layer to queue the residual as new request.
      
      Both error handling and formatting needs to release the
      ST-DMA lock, so call finish_fdc() on these (this was previously
      handled by redo_fd_request()). finish_fdc() may be called
      legitimately without the ST-DMA lock held - make sure we only
      release the lock if we actually held it. In a similar way,
      early exit due to errors in ataflop_queue_rq() must release
      the lock.
      
      After minor errors, fd_error sets up to recalibrate the drive
      but never re-runs the current operation (another task handled by
      redo_fd_request() before). Call do_fd_action() to get the next
      steps (seek, retry read/write) underway.
      Signed-off-by: default avatarMichael Schmitz <schmitzmic@gmail.com>
      Fixes: 6ec3938c (ataflop: convert to blk-mq)
      CC: linux-block@vger.kernel.org
      Link: https://lore.kernel.org/r/20211024002013.9332-1-schmitzmic@gmail.comSigned-off-by: default avatarJens Axboe <axboe@kernel.dk>
      d28e4dff
  8. 22 Oct, 2021 1 commit
  9. 21 Oct, 2021 9 commits
  10. 20 Oct, 2021 3 commits
    • Len Baker's avatar
      nvmet: use struct_size over open coded arithmetic · 117d5b6d
      Len Baker authored
      As noted in the "Deprecated Interfaces, Language Features, Attributes,
      and Conventions" documentation [1], size calculations (especially
      multiplication) should not be performed in memory allocator (or similar)
      function arguments due to the risk of them overflowing. This could lead
      to values wrapping around and a smaller allocation being made than the
      caller was expecting. Using those allocations could lead to linear
      overflows of heap memory and other misbehaviors.
      
      In this case this is not actually dynamic size: all the operands
      involved in the calculation are constant values. However it is better to
      refactor this anyway, just to keep the open-coded math idiom out of
      code.
      
      So, use the struct_size() helper to do the arithmetic instead of the
      argument "size + count * size" in the kmalloc() function.
      
      This code was detected with the help of Coccinelle and audited and fixed
      manually.
      
      [1] https://www.kernel.org/doc/html/latest/process/deprecated.html#open-coded-arithmetic-in-allocator-argumentsSigned-off-by: default avatarLen Baker <len.baker@gmx.com>
      Signed-off-by: default avatarChristoph Hellwig <hch@lst.de>
      117d5b6d
    • Hannes Reinecke's avatar
      nvme: drop scan_lock and always kick requeue list when removing namespaces · 2b81a5f0
      Hannes Reinecke authored
      When reading the partition table on initial scan hits an I/O error the
      I/O will hang with the scan_mutex held:
      
      [<0>] do_read_cache_page+0x49b/0x790
      [<0>] read_part_sector+0x39/0xe0
      [<0>] read_lba+0xf9/0x1d0
      [<0>] efi_partition+0xf1/0x7f0
      [<0>] bdev_disk_changed+0x1ee/0x550
      [<0>] blkdev_get_whole+0x81/0x90
      [<0>] blkdev_get_by_dev+0x128/0x2e0
      [<0>] device_add_disk+0x377/0x3c0
      [<0>] nvme_mpath_set_live+0x130/0x1b0 [nvme_core]
      [<0>] nvme_mpath_add_disk+0x150/0x160 [nvme_core]
      [<0>] nvme_alloc_ns+0x417/0x950 [nvme_core]
      [<0>] nvme_validate_or_alloc_ns+0xe9/0x1e0 [nvme_core]
      [<0>] nvme_scan_work+0x168/0x310 [nvme_core]
      [<0>] process_one_work+0x231/0x420
      
      and trying to delete the controller will deadlock as it tries to grab
      the scan mutex:
      
      [<0>] nvme_mpath_clear_ctrl_paths+0x25/0x80 [nvme_core]
      [<0>] nvme_remove_namespaces+0x31/0xf0 [nvme_core]
      [<0>] nvme_do_delete_ctrl+0x4b/0x80 [nvme_core]
      
      As we're now properly ordering the namespace list there is no need to
      hold the scan_mutex in nvme_mpath_clear_ctrl_paths() anymore.
      And we always need to kick the requeue list as the path will be marked
      as unusable and I/O will be requeued _without_ a current path.
      Signed-off-by: default avatarHannes Reinecke <hare@suse.de>
      Reviewed-by: default avatarKeith Busch <kbusch@kernel.org>
      Reviewed-by: default avatarSagi Grimberg <sagi@grimberg.me>
      Signed-off-by: default avatarChristoph Hellwig <hch@lst.de>
      2b81a5f0
    • Keith Busch's avatar
      nvme-pci: clear shadow doorbell memory on resets · 58847f12
      Keith Busch authored
      The host memory doorbell and event buffers need to be initialized on
      each reset so the driver doesn't observe stale values from the previous
      instantiation.
      Signed-off-by: default avatarKeith Busch <kbusch@kernel.org>
      Tested-by: default avatarJohn Levon <john.levon@nutanix.com>
      Signed-off-by: default avatarChristoph Hellwig <hch@lst.de>
      58847f12