public inbox for linux-block@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH V2 0/8] block/scsi: safe SCSI quiescing
@ 2017-09-01 18:49 Ming Lei
  2017-09-01 18:49 ` Ming Lei
                   ` (9 more replies)
  0 siblings, 10 replies; 13+ messages in thread
From: Ming Lei @ 2017-09-01 18:49 UTC (permalink / raw)
  To: Jens Axboe, linux-block, Christoph Hellwig, Bart Van Assche,
	linux-scsi, Martin K . Petersen, James E . J . Bottomley
  Cc: Oleksandr Natalenko, Johannes Thumshirn, Tejun Heo, Ming Lei

Hi,

The current SCSI quiesce isn't safe and easy to trigger I/O deadlock.

Once SCSI device is put into QUIESCE, no new request except for RQF_PREEMPT
can be dispatched to SCSI successfully, and scsi_device_quiesce() just simply
waits for completion of I/Os dispatched to SCSI stack. It isn't enough at all.

Because new request still can be allocated, but all the allocated
requests can't be dispatched successfully, so request pool can be
consumed up easily.

Then request with RQF_PREEMPT can't be allocated, and system may
hang forever, such as during system suspend or SCSI domain alidation.

Both IO hang inside system suspend[1] or SCSI domain validation
were reported before.

This patch tries to solve the issue by freezing block queue during
SCSI quiescing, and allowing to allocate request of RQF_PREEMPT
when queue is frozen.

Both SCSI and SCSI_MQ have this IO deadlock issue, this patch fixes
them all by introducing preempt version of blk_freeze_queue() and
blk_unfreeze_queue().

V2:
	- drop the 1st patch in V1 because percpu_ref_is_dying() is
	enough as pointed by Tejun

	- introduce preempt version of blk_[freeze|unfreeze]_queue

	- sync between preempt freeze and normal freeze

	- fix warning from percpu-refcount as reported by Oleksandr


[1] https://marc.info/?t=150340250100013&r=3&w=2



Ming Lei (8):
  blk-mq: rename blk_mq_unfreeze_queue as blk_unfreeze_queue
  blk-mq: rename blk_mq_freeze_queue as blk_freeze_queue
  blk-mq: only run hw queues for blk-mq
  blk-mq: rename blk_mq_freeze_queue_wait as blk_freeze_queue_wait
  block: tracking request allocation with q_usage_counter
  block: allow to allocate req with REQF_PREEMPT when queue is frozen
  block: introduce preempt version of blk_[freeze|unfreeze]_queue
  SCSI: freeze block queue when SCSI device is put into quiesce

 block/bfq-iosched.c      |   2 +-
 block/blk-cgroup.c       |   8 ++--
 block/blk-core.c         |  50 ++++++++++++++++----
 block/blk-mq.c           | 119 ++++++++++++++++++++++++++++++++++++-----------
 block/blk-mq.h           |   1 -
 block/blk.h              |   6 +++
 block/elevator.c         |   4 +-
 drivers/block/loop.c     |  16 +++----
 drivers/block/rbd.c      |   2 +-
 drivers/nvme/host/core.c |   8 ++--
 drivers/scsi/scsi_lib.c  |  21 ++++++++-
 include/linux/blk-mq.h   |  15 +++---
 include/linux/blkdev.h   |  20 +++++++-
 13 files changed, 206 insertions(+), 66 deletions(-)

-- 
2.9.5

^ permalink raw reply	[flat|nested] 13+ messages in thread

end of thread, other threads:[~2017-09-02  7:12 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-09-01 18:49 [PATCH V2 0/8] block/scsi: safe SCSI quiescing Ming Lei
2017-09-01 18:49 ` Ming Lei
2017-09-01 18:49 ` [PATCH V2 1/8] blk-mq: rename blk_mq_unfreeze_queue as blk_unfreeze_queue Ming Lei
2017-09-01 18:49 ` [PATCH V2 2/8] blk-mq: rename blk_mq_freeze_queue as blk_freeze_queue Ming Lei
2017-09-01 18:49 ` [PATCH V2 3/8] blk-mq: only run hw queues for blk-mq Ming Lei
2017-09-01 18:49 ` [PATCH V2 4/8] blk-mq: rename blk_mq_freeze_queue_wait as blk_freeze_queue_wait Ming Lei
2017-09-01 18:49 ` [PATCH V2 5/8] block: tracking request allocation with q_usage_counter Ming Lei
2017-09-01 18:49 ` [PATCH V2 6/8] block: allow to allocate req with REQF_PREEMPT when queue is frozen Ming Lei
2017-09-01 20:07   ` Bart Van Assche
2017-09-02  2:52     ` Ming Lei
2017-09-01 18:49 ` [PATCH V2 7/8] block: introduce preempt version of blk_[freeze|unfreeze]_queue Ming Lei
2017-09-01 18:49 ` [PATCH V2 8/8] SCSI: freeze block queue when SCSI device is put into quiesce Ming Lei
2017-09-02  7:12 ` [PATCH V2 0/8] block/scsi: safe SCSI quiescing Oleksandr Natalenko

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox