• Bart Van Assche's avatar
    blk-mq: Introduce blk_mq_quiesce_queue() · 6a83e74d
    Bart Van Assche authored
    blk_mq_quiesce_queue() waits until ongoing .queue_rq() invocations
    have finished. This function does *not* wait until all outstanding
    requests have finished (this means invocation of request.end_io()).
    The algorithm used by blk_mq_quiesce_queue() is as follows:
    * Hold either an RCU read lock or an SRCU read lock around
      .queue_rq() calls. The former is used if .queue_rq() does not
      block and the latter if .queue_rq() may block.
    * blk_mq_quiesce_queue() first calls blk_mq_stop_hw_queues()
      followed by synchronize_srcu() or synchronize_rcu(). The latter
      call waits for .queue_rq() invocations that started before
      blk_mq_quiesce_queue() was called.
    * The blk_mq_hctx_stopped() calls that control whether or not
      .queue_rq() will be called are called with the (S)RCU read lock
      held. This is necessary to avoid race conditions against
      blk_mq_quiesce_queue().
    Signed-off-by: default avatarBart Van Assche <bart.vanassche@sandisk.com>
    Cc: Hannes Reinecke <hare@suse.com>
    Cc: Johannes Thumshirn <jthumshirn@suse.de>
    Reviewed-by: default avatarSagi Grimberg <sagi@grimberg.me>
    Reviewed-by: default avatarMing Lei <tom.leiming@gmail.com>
    Reviewed-by: default avatarChristoph Hellwig <hch@lst.de>
    Signed-off-by: default avatarJens Axboe <axboe@fb.com>
    6a83e74d
Kconfig 4.04 KB