1. 04 May, 2019 2 commits
    • Ming Lei's avatar
      blk-mq: move cancel of requeue_work into blk_mq_release · fbc2a15e
      Ming Lei authored
      With holding queue's kobject refcount, it is safe for driver
      to schedule requeue. However, blk_mq_kick_requeue_list() may
      be called after blk_sync_queue() is done because of concurrent
      requeue activities, then requeue work may not be completed when
      freeing queue, and kernel oops is triggered.
      
      So moving the cancel of requeue_work into blk_mq_release() for
      avoiding race between requeue and freeing queue.
      
      Cc: Dongli Zhang <dongli.zhang@oracle.com>
      Cc: James Smart <james.smart@broadcom.com>
      Cc: Bart Van Assche <bart.vanassche@wdc.com>
      Cc: linux-scsi@vger.kernel.org,
      Cc: Martin K . Petersen <martin.petersen@oracle.com>,
      Cc: Christoph Hellwig <hch@lst.de>,
      Cc: James E . J . Bottomley <jejb@linux.vnet.ibm.com>,
      Reviewed-by: default avatarBart Van Assche <bvanassche@acm.org>
      Reviewed-by: default avatarJohannes Thumshirn <jthumshirn@suse.de>
      Reviewed-by: default avatarHannes Reinecke <hare@suse.com>
      Reviewed-by: default avatarChristoph Hellwig <hch@lst.de>
      Tested-by: default avatarJames Smart <james.smart@broadcom.com>
      Signed-off-by: default avatarMing Lei <ming.lei@redhat.com>
      Signed-off-by: default avatarJens Axboe <axboe@kernel.dk>
      fbc2a15e
    • Ming Lei's avatar
      blk-mq: grab .q_usage_counter when queuing request from plug code path · e87eb301
      Ming Lei authored
      Just like aio/io_uring, we need to grab 2 refcount for queuing one
      request, one is for submission, another is for completion.
      
      If the request isn't queued from plug code path, the refcount grabbed
      in generic_make_request() serves for submission. In theroy, this
      refcount should have been released after the sumission(async run queue)
      is done. blk_freeze_queue() works with blk_sync_queue() together
      for avoiding race between cleanup queue and IO submission, given async
      run queue activities are canceled because hctx->run_work is scheduled with
      the refcount held, so it is fine to not hold the refcount when
      running the run queue work function for dispatch IO.
      
      However, if request is staggered into plug list, and finally queued
      from plug code path, the refcount in submission side is actually missed.
      And we may start to run queue after queue is removed because the queue's
      kobject refcount isn't guaranteed to be grabbed in flushing plug list
      context, then kernel oops is triggered, see the following race:
      
      blk_mq_flush_plug_list():
              blk_mq_sched_insert_requests()
                      insert requests to sw queue or scheduler queue
                      blk_mq_run_hw_queue
      
      Because of concurrent run queue, all requests inserted above may be
      completed before calling the above blk_mq_run_hw_queue. Then queue can
      be freed during the above blk_mq_run_hw_queue().
      
      Fixes the issue by grab .q_usage_counter before calling
      blk_mq_sched_insert_requests() in blk_mq_flush_plug_list(). This way is
      safe because the queue is absolutely alive before inserting request.
      
      Cc: Dongli Zhang <dongli.zhang@oracle.com>
      Cc: James Smart <james.smart@broadcom.com>
      Cc: linux-scsi@vger.kernel.org,
      Cc: Martin K . Petersen <martin.petersen@oracle.com>,
      Cc: Christoph Hellwig <hch@lst.de>,
      Cc: James E . J . Bottomley <jejb@linux.vnet.ibm.com>,
      Reviewed-by: default avatarBart Van Assche <bvanassche@acm.org>
      Tested-by: default avatarJames Smart <james.smart@broadcom.com>
      Signed-off-by: default avatarMing Lei <ming.lei@redhat.com>
      Signed-off-by: default avatarJens Axboe <axboe@kernel.dk>
      e87eb301
  2. 02 May, 2019 2 commits
  3. 01 May, 2019 13 commits
  4. 30 Apr, 2019 12 commits
  5. 26 Apr, 2019 1 commit
    • Jens Axboe's avatar
      Merge branch 'nvme-5.2' of git://git.infradead.org/nvme into for-5.2/block · 41d7f2ed
      Jens Axboe authored
      Pull NVMe changes from Christoph.
      
      * 'nvme-5.2' of git://git.infradead.org/nvme:
        nvme: set 0 capacity if namespace block size exceeds PAGE_SIZE
        nvme-rdma: fix typo in struct comment
        nvme-loop: kill timeout handler
        nvme-tcp: rename function to have nvme_tcp prefix
        nvme-rdma: fix a NULL deref when an admin connect times out
        nvme-tcp: fix a NULL deref when an admin connect times out
        nvmet-tcp: don't fail maxr2t greater than 1
        nvmet-file: clamp-down file namespace lba_shift
        nvmet: include <linux/scatterlist.h>
        nvmet: return a specified error it subsys_alloc fails
        nvmet: rename nvme_completion instances from rsp to cqe
        nvmet-rdma: remove p2p_client initialization from fast-path
      41d7f2ed
  6. 25 Apr, 2019 10 commits