On Sat, 2017-09-02 at 21:12 +0800, Ming Lei wrote:
> Please let us know if V3 addresses your previous concern about calling
> blk_queue_enter_live() during preempt freezing.

Do you understand how request queue cleanup works? The algorithm used for
request queue cleanup is as follows:
* Set the DYING flag. This flag makes all later blk_get_request() calls
  fail.
* Wait until all pending requests have finished.
* Set the DEAD flag. For the traditional block layer, this flag causes
  blk_run_queue() not to call .request_fn() anymore. For blk-mq it is
  guaranteed in another way that .queue_rq() won't be called anymore after
  this flag has been set.

Allowing blk_get_request() to succeed after the DYING flag has been set is
completely wrong because that could result in a request being queued after
the DEAD flag has been set, resulting in either a hanging request or a kernel
crash. This is why it's completely wrong to add a blk_queue_enter_live() call
in blk_old_get_request() or blk_mq_alloc_request(). Hence my NAK for any
patch that adds a blk_queue_enter_live() call to any function called from
blk_get_request(). That includes the patch at the start of this e-mail thread.

Bart.

Reply via email to