All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH V8 0/8] block/scsi: safe SCSI quiescing
@ 2017-10-03 14:03 Ming Lei
  2017-10-03 14:03 ` [PATCH V8 1/8] blk-mq: only run hw queues for blk-mq Ming Lei
                   ` (9 more replies)
  0 siblings, 10 replies; 19+ messages in thread
From: Ming Lei @ 2017-10-03 14:03 UTC (permalink / raw)
  To: Jens Axboe, linux-block, Christoph Hellwig, linux-scsi,
	Martin K . Petersen, James E . J . Bottomley
  Cc: Bart Van Assche, Oleksandr Natalenko, Johannes Thumshirn,
	Cathy Avery, Martin Steigerwald, linux-kernel, Hannes Reinecke,
	Ming Lei

Hi Jens,

Please consider this patchset for V4.15, and it fixes one
kind of long-term I/O hang issue in either block legacy path
or blk-mq.

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 comming, 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 wait forever,
then system hangs forever, such as during system suspend or
sending SCSI domain alidation in case of transport_spi.

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

This patch introduces preempt only mode, and solves the issue
by allowing RQF_PREEMP only during SCSI quiesce.

Both SCSI and SCSI_MQ have this IO deadlock issue, this patch fixes
them all.

V8:
	- fix one race as pointed out by Bart
	- pass 'op' to blk_queue_enter() as suggested by Christoph

V7:
	- add Reviewed-by & Tested-by
	- one line change in patch 5 for checking preempt request

V6:
	- borrow Bart's idea of preempt only, with clean
	  implementation(patch 5/patch 6)
	- needn't any external driver's dependency, such as MD's
	change

V5:
	- fix one tiny race by introducing blk_queue_enter_preempt_freeze()
	given this change is small enough compared with V4, I added
	tested-by directly

V4:
	- reorganize patch order to make it more reasonable
	- support nested preempt freeze, as required by SCSI transport spi
	- check preempt freezing in slow path of of blk_queue_enter()
	- add "SCSI: transport_spi: resume a quiesced device"
	- wake up freeze queue in setting dying for both blk-mq and legacy
	- rename blk_mq_[freeze|unfreeze]_queue() in one patch
	- rename .mq_freeze_wq and .mq_freeze_depth
	- improve comment

V3:
	- introduce q->preempt_unfreezing to fix one bug of preempt freeze
	- call blk_queue_enter_live() only when queue is preempt frozen
	- cleanup a bit on the implementation of preempt freeze
	- only patch 6 and 7 are changed

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


Thanks,
Ming

Bart Van Assche (1):
  block: Convert RQF_PREEMPT into REQ_PREEMPT

Ming Lei (7):
  blk-mq: only run hw queues for blk-mq
  block: tracking request allocation with q_usage_counter
  block: pass 'op' to blk_queue_enter()
  percpu-refcount: introduce __percpu_ref_tryget_live
  blk-mq: return if queue is frozen via current blk_freeze_queue_start
  block: support PREEMPT_ONLY
  SCSI: set block queue at preempt only when SCSI device is put into
    quiesce

 block/blk-core.c                | 66 +++++++++++++++++++++++++++++++++++++----
 block/blk-mq-debugfs.c          |  2 +-
 block/blk-mq.c                  | 26 ++++++++--------
 block/blk-mq.h                  |  1 -
 block/blk-timeout.c             |  2 +-
 block/blk.h                     |  2 +-
 drivers/ide/ide-atapi.c         |  3 +-
 drivers/ide/ide-io.c            |  2 +-
 drivers/ide/ide-pm.c            |  4 +--
 drivers/scsi/scsi_lib.c         | 31 +++++++++++++++----
 fs/block_dev.c                  |  4 +--
 include/linux/blk-mq.h          |  4 +--
 include/linux/blk_types.h       |  6 ++++
 include/linux/blkdev.h          | 10 ++++---
 include/linux/percpu-refcount.h | 27 ++++++++++-------
 15 files changed, 137 insertions(+), 53 deletions(-)

-- 
2.9.5

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

* [PATCH V8 1/8] blk-mq: only run hw queues for blk-mq
  2017-10-03 14:03 [PATCH V8 0/8] block/scsi: safe SCSI quiescing Ming Lei
@ 2017-10-03 14:03 ` Ming Lei
  2017-10-03 14:04 ` [PATCH V8 2/8] block: tracking request allocation with q_usage_counter Ming Lei
                   ` (8 subsequent siblings)
  9 siblings, 0 replies; 19+ messages in thread
From: Ming Lei @ 2017-10-03 14:03 UTC (permalink / raw)
  To: Jens Axboe, linux-block, Christoph Hellwig, linux-scsi,
	Martin K . Petersen, James E . J . Bottomley
  Cc: Bart Van Assche, Oleksandr Natalenko, Johannes Thumshirn,
	Cathy Avery, Martin Steigerwald, linux-kernel, Hannes Reinecke,
	Ming Lei, Bart Van Assche

This patch just makes it explicitely.

Tested-by: Oleksandr Natalenko <oleksandr@natalenko.name>
Tested-by: Martin Steigerwald <martin@lichtvoll.de>
Reviewed-by: Johannes Thumshirn <jthumshirn@suse.de>
Cc: Bart Van Assche <Bart.VanAssche@wdc.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Ming Lei <ming.lei@redhat.com>
---
 block/blk-mq.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/block/blk-mq.c b/block/blk-mq.c
index 98a18609755e..6fd9f86fc86d 100644
--- a/block/blk-mq.c
+++ b/block/blk-mq.c
@@ -125,7 +125,8 @@ void blk_freeze_queue_start(struct request_queue *q)
 	freeze_depth = atomic_inc_return(&q->mq_freeze_depth);
 	if (freeze_depth == 1) {
 		percpu_ref_kill(&q->q_usage_counter);
-		blk_mq_run_hw_queues(q, false);
+		if (q->mq_ops)
+			blk_mq_run_hw_queues(q, false);
 	}
 }
 EXPORT_SYMBOL_GPL(blk_freeze_queue_start);
-- 
2.9.5

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

* [PATCH V8 2/8] block: tracking request allocation with q_usage_counter
  2017-10-03 14:03 [PATCH V8 0/8] block/scsi: safe SCSI quiescing Ming Lei
  2017-10-03 14:03 ` [PATCH V8 1/8] blk-mq: only run hw queues for blk-mq Ming Lei
@ 2017-10-03 14:04 ` Ming Lei
  2017-10-03 14:04 ` [PATCH V8 3/8] block: Convert RQF_PREEMPT into REQ_PREEMPT Ming Lei
                   ` (7 subsequent siblings)
  9 siblings, 0 replies; 19+ messages in thread
From: Ming Lei @ 2017-10-03 14:04 UTC (permalink / raw)
  To: Jens Axboe, linux-block, Christoph Hellwig, linux-scsi,
	Martin K . Petersen, James E . J . Bottomley
  Cc: Bart Van Assche, Oleksandr Natalenko, Johannes Thumshirn,
	Cathy Avery, Martin Steigerwald, linux-kernel, Hannes Reinecke,
	Ming Lei, Bart Van Assche

This usage is basically same with blk-mq, so that we can
support to freeze legacy queue easily.

Also 'wake_up_all(&q->mq_freeze_wq)' has to be moved
into blk_set_queue_dying() since both legacy and blk-mq
may wait on the wait queue of .mq_freeze_wq.

Tested-by: Oleksandr Natalenko <oleksandr@natalenko.name>
Tested-by: Martin Steigerwald <martin@lichtvoll.de>
Reviewed-by: Hannes Reinecke <hare@suse.com>
Cc: Bart Van Assche <Bart.VanAssche@wdc.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Ming Lei <ming.lei@redhat.com>
---
 block/blk-core.c | 15 +++++++++++++++
 block/blk-mq.c   |  7 -------
 2 files changed, 15 insertions(+), 7 deletions(-)

diff --git a/block/blk-core.c b/block/blk-core.c
index 048be4aa6024..900eaa8eefa6 100644
--- a/block/blk-core.c
+++ b/block/blk-core.c
@@ -610,6 +610,12 @@ void blk_set_queue_dying(struct request_queue *q)
 		}
 		spin_unlock_irq(q->queue_lock);
 	}
+
+	/*
+	 * We need to ensure that processes currently waiting on
+	 * the queue are notified as well.
+	 */
+	wake_up_all(&q->mq_freeze_wq);
 }
 EXPORT_SYMBOL_GPL(blk_set_queue_dying);
 
@@ -1395,16 +1401,22 @@ static struct request *blk_old_get_request(struct request_queue *q,
 					   unsigned int op, gfp_t gfp_mask)
 {
 	struct request *rq;
+	int ret = 0;
 
 	WARN_ON_ONCE(q->mq_ops);
 
 	/* create ioc upfront */
 	create_io_context(gfp_mask, q->node);
 
+	ret = blk_queue_enter(q, !(gfp_mask & __GFP_DIRECT_RECLAIM) ||
+			(op & REQ_NOWAIT));
+	if (ret)
+		return ERR_PTR(ret);
 	spin_lock_irq(q->queue_lock);
 	rq = get_request(q, op, NULL, gfp_mask);
 	if (IS_ERR(rq)) {
 		spin_unlock_irq(q->queue_lock);
+		blk_queue_exit(q);
 		return rq;
 	}
 
@@ -1576,6 +1588,7 @@ void __blk_put_request(struct request_queue *q, struct request *req)
 		blk_free_request(rl, req);
 		freed_request(rl, sync, rq_flags);
 		blk_put_rl(rl);
+		blk_queue_exit(q);
 	}
 }
 EXPORT_SYMBOL_GPL(__blk_put_request);
@@ -1857,8 +1870,10 @@ static blk_qc_t blk_queue_bio(struct request_queue *q, struct bio *bio)
 	 * Grab a free request. This is might sleep but can not fail.
 	 * Returns with the queue unlocked.
 	 */
+	blk_queue_enter_live(q);
 	req = get_request(q, bio->bi_opf, bio, GFP_NOIO);
 	if (IS_ERR(req)) {
+		blk_queue_exit(q);
 		__wbt_done(q->rq_wb, wb_acct);
 		if (PTR_ERR(req) == -ENOMEM)
 			bio->bi_status = BLK_STS_RESOURCE;
diff --git a/block/blk-mq.c b/block/blk-mq.c
index 6fd9f86fc86d..10c1f49f663d 100644
--- a/block/blk-mq.c
+++ b/block/blk-mq.c
@@ -256,13 +256,6 @@ void blk_mq_wake_waiters(struct request_queue *q)
 	queue_for_each_hw_ctx(q, hctx, i)
 		if (blk_mq_hw_queue_mapped(hctx))
 			blk_mq_tag_wakeup_all(hctx->tags, true);
-
-	/*
-	 * If we are called because the queue has now been marked as
-	 * dying, we need to ensure that processes currently waiting on
-	 * the queue are notified as well.
-	 */
-	wake_up_all(&q->mq_freeze_wq);
 }
 
 bool blk_mq_can_queue(struct blk_mq_hw_ctx *hctx)
-- 
2.9.5

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

* [PATCH V8 3/8] block: Convert RQF_PREEMPT into REQ_PREEMPT
  2017-10-03 14:03 [PATCH V8 0/8] block/scsi: safe SCSI quiescing Ming Lei
  2017-10-03 14:03 ` [PATCH V8 1/8] blk-mq: only run hw queues for blk-mq Ming Lei
  2017-10-03 14:04 ` [PATCH V8 2/8] block: tracking request allocation with q_usage_counter Ming Lei
@ 2017-10-03 14:04 ` Ming Lei
  2017-10-03 14:04 ` [PATCH V8 4/8] block: pass 'op' to blk_queue_enter() Ming Lei
                   ` (6 subsequent siblings)
  9 siblings, 0 replies; 19+ messages in thread
From: Ming Lei @ 2017-10-03 14:04 UTC (permalink / raw)
  To: Jens Axboe, linux-block, Christoph Hellwig, linux-scsi,
	Martin K . Petersen, James E . J . Bottomley
  Cc: Bart Van Assche, Oleksandr Natalenko, Johannes Thumshirn,
	Cathy Avery, Martin Steigerwald, linux-kernel, Hannes Reinecke,
	Bart Van Assche, Ming Lei, Christoph Hellwig

From: Bart Van Assche <bart.vanassche@wdc.com>

This patch does not change any functionality but makes the
REQ_PREEMPT flag available to blk_get_request(). A later patch
will add code to blk_get_request() that checks the REQ_PREEMPT
flag. Note: the IDE sense_rq request is allocated statically so
there is no blk_get_request() call that corresponds to this
request.

Signed-off-by: Bart Van Assche <bart.vanassche@wdc.com>
Cc: Ming Lei <ming.lei@redhat.com>
Cc: Christoph Hellwig <hch@lst.de>
Cc: Hannes Reinecke <hare@suse.com>
Cc: Johannes Thumshirn <jthumshirn@suse.de>
---
 block/blk-mq-debugfs.c    |  2 +-
 drivers/ide/ide-atapi.c   |  3 +--
 drivers/ide/ide-io.c      |  2 +-
 drivers/ide/ide-pm.c      |  4 ++--
 drivers/scsi/scsi_lib.c   | 11 ++++++-----
 include/linux/blk_types.h |  6 ++++++
 include/linux/blkdev.h    |  3 ---
 7 files changed, 17 insertions(+), 14 deletions(-)

diff --git a/block/blk-mq-debugfs.c b/block/blk-mq-debugfs.c
index 980e73095643..62ac248a4984 100644
--- a/block/blk-mq-debugfs.c
+++ b/block/blk-mq-debugfs.c
@@ -266,6 +266,7 @@ static const char *const cmd_flag_name[] = {
 	CMD_FLAG_NAME(BACKGROUND),
 	CMD_FLAG_NAME(NOUNMAP),
 	CMD_FLAG_NAME(NOWAIT),
+	CMD_FLAG_NAME(PREEMPT),
 };
 #undef CMD_FLAG_NAME
 
@@ -279,7 +280,6 @@ static const char *const rqf_name[] = {
 	RQF_NAME(MIXED_MERGE),
 	RQF_NAME(MQ_INFLIGHT),
 	RQF_NAME(DONTPREP),
-	RQF_NAME(PREEMPT),
 	RQF_NAME(COPY_USER),
 	RQF_NAME(FAILED),
 	RQF_NAME(QUIET),
diff --git a/drivers/ide/ide-atapi.c b/drivers/ide/ide-atapi.c
index 14d1e7d9a1d6..1258739d5fa1 100644
--- a/drivers/ide/ide-atapi.c
+++ b/drivers/ide/ide-atapi.c
@@ -211,9 +211,8 @@ void ide_prep_sense(ide_drive_t *drive, struct request *rq)
 	}
 
 	sense_rq->rq_disk = rq->rq_disk;
-	sense_rq->cmd_flags = REQ_OP_DRV_IN;
+	sense_rq->cmd_flags = REQ_OP_DRV_IN | REQ_PREEMPT;
 	ide_req(sense_rq)->type = ATA_PRIV_SENSE;
-	sense_rq->rq_flags |= RQF_PREEMPT;
 
 	req->cmd[0] = GPCMD_REQUEST_SENSE;
 	req->cmd[4] = cmd_len;
diff --git a/drivers/ide/ide-io.c b/drivers/ide/ide-io.c
index 3a234701d92c..06ffccd0fb10 100644
--- a/drivers/ide/ide-io.c
+++ b/drivers/ide/ide-io.c
@@ -539,7 +539,7 @@ void do_ide_request(struct request_queue *q)
 		 */
 		if ((drive->dev_flags & IDE_DFLAG_BLOCKED) &&
 		    ata_pm_request(rq) == 0 &&
-		    (rq->rq_flags & RQF_PREEMPT) == 0) {
+		    (rq->cmd_flags & REQ_PREEMPT) == 0) {
 			/* there should be no pending command at this point */
 			ide_unlock_port(hwif);
 			goto plug_device;
diff --git a/drivers/ide/ide-pm.c b/drivers/ide/ide-pm.c
index 544f02d673ca..f8d2709dcd56 100644
--- a/drivers/ide/ide-pm.c
+++ b/drivers/ide/ide-pm.c
@@ -89,9 +89,9 @@ int generic_ide_resume(struct device *dev)
 	}
 
 	memset(&rqpm, 0, sizeof(rqpm));
-	rq = blk_get_request(drive->queue, REQ_OP_DRV_IN, __GFP_RECLAIM);
+	rq = blk_get_request(drive->queue, REQ_OP_DRV_IN | REQ_PREEMPT,
+			     __GFP_RECLAIM);
 	ide_req(rq)->type = ATA_PRIV_PM_RESUME;
-	rq->rq_flags |= RQF_PREEMPT;
 	rq->special = &rqpm;
 	rqpm.pm_step = IDE_PM_START_RESUME;
 	rqpm.pm_state = PM_EVENT_ON;
diff --git a/drivers/scsi/scsi_lib.c b/drivers/scsi/scsi_lib.c
index 9cf6a80fe297..62f905b22821 100644
--- a/drivers/scsi/scsi_lib.c
+++ b/drivers/scsi/scsi_lib.c
@@ -253,8 +253,9 @@ int scsi_execute(struct scsi_device *sdev, const unsigned char *cmd,
 	int ret = DRIVER_ERROR << 24;
 
 	req = blk_get_request(sdev->request_queue,
-			data_direction == DMA_TO_DEVICE ?
-			REQ_OP_SCSI_OUT : REQ_OP_SCSI_IN, __GFP_RECLAIM);
+			      (data_direction == DMA_TO_DEVICE ?
+			       REQ_OP_SCSI_OUT : REQ_OP_SCSI_IN) | REQ_PREEMPT,
+			      __GFP_RECLAIM);
 	if (IS_ERR(req))
 		return ret;
 	rq = scsi_req(req);
@@ -268,7 +269,7 @@ int scsi_execute(struct scsi_device *sdev, const unsigned char *cmd,
 	rq->retries = retries;
 	req->timeout = timeout;
 	req->cmd_flags |= flags;
-	req->rq_flags |= rq_flags | RQF_QUIET | RQF_PREEMPT;
+	req->rq_flags |= rq_flags | RQF_QUIET;
 
 	/*
 	 * head injection *required* here otherwise quiesce won't work
@@ -1301,7 +1302,7 @@ scsi_prep_state_check(struct scsi_device *sdev, struct request *req)
 			/*
 			 * If the devices is blocked we defer normal commands.
 			 */
-			if (!(req->rq_flags & RQF_PREEMPT))
+			if (!(req->cmd_flags & REQ_PREEMPT))
 				ret = BLKPREP_DEFER;
 			break;
 		default:
@@ -1310,7 +1311,7 @@ scsi_prep_state_check(struct scsi_device *sdev, struct request *req)
 			 * special commands.  In particular any user initiated
 			 * command is not allowed.
 			 */
-			if (!(req->rq_flags & RQF_PREEMPT))
+			if (!(req->cmd_flags & REQ_PREEMPT))
 				ret = BLKPREP_KILL;
 			break;
 		}
diff --git a/include/linux/blk_types.h b/include/linux/blk_types.h
index a2d2aa709cef..b6b6bf44e462 100644
--- a/include/linux/blk_types.h
+++ b/include/linux/blk_types.h
@@ -229,6 +229,11 @@ enum req_flag_bits {
 	__REQ_NOUNMAP,		/* do not free blocks when zeroing */
 
 	__REQ_NOWAIT,           /* Don't wait if request will block */
+	/*
+	 * set for "ide_preempt" requests and also for requests for which the
+	 * SCSI "quiesce" state must be ignored.
+	 */
+	__REQ_PREEMPT,
 	__REQ_NR_BITS,		/* stops here */
 };
 
@@ -248,6 +253,7 @@ enum req_flag_bits {
 
 #define REQ_NOUNMAP		(1ULL << __REQ_NOUNMAP)
 #define REQ_NOWAIT		(1ULL << __REQ_NOWAIT)
+#define REQ_PREEMPT		(1ULL << __REQ_PREEMPT)
 
 #define REQ_FAILFAST_MASK \
 	(REQ_FAILFAST_DEV | REQ_FAILFAST_TRANSPORT | REQ_FAILFAST_DRIVER)
diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h
index 02fa42d24b52..ab6b6c0392c2 100644
--- a/include/linux/blkdev.h
+++ b/include/linux/blkdev.h
@@ -96,9 +96,6 @@ typedef __u32 __bitwise req_flags_t;
 #define RQF_MQ_INFLIGHT		((__force req_flags_t)(1 << 6))
 /* don't call prep for this one */
 #define RQF_DONTPREP		((__force req_flags_t)(1 << 7))
-/* set for "ide_preempt" requests and also for requests for which the SCSI
-   "quiesce" state must be ignored. */
-#define RQF_PREEMPT		((__force req_flags_t)(1 << 8))
 /* contains copies of user pages */
 #define RQF_COPY_USER		((__force req_flags_t)(1 << 9))
 /* vaguely specified driver internal error.  Ignored by the block layer */
-- 
2.9.5

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

* [PATCH V8 4/8] block: pass 'op' to blk_queue_enter()
  2017-10-03 14:03 [PATCH V8 0/8] block/scsi: safe SCSI quiescing Ming Lei
                   ` (2 preceding siblings ...)
  2017-10-03 14:04 ` [PATCH V8 3/8] block: Convert RQF_PREEMPT into REQ_PREEMPT Ming Lei
@ 2017-10-03 14:04 ` Ming Lei
  2017-10-03 14:04 ` [PATCH V8 5/8] percpu-refcount: introduce __percpu_ref_tryget_live Ming Lei
                   ` (5 subsequent siblings)
  9 siblings, 0 replies; 19+ messages in thread
From: Ming Lei @ 2017-10-03 14:04 UTC (permalink / raw)
  To: Jens Axboe, linux-block, Christoph Hellwig, linux-scsi,
	Martin K . Petersen, James E . J . Bottomley
  Cc: Bart Van Assche, Oleksandr Natalenko, Johannes Thumshirn,
	Cathy Avery, Martin Steigerwald, linux-kernel, Hannes Reinecke,
	Ming Lei, Bart Van Assche

We need to check if the request to be allocated is PREEMPT_ONLY,
and have to pass REQ_PREEEMPT flag to blk_queue_eneter(), so pass
'op' to blk_queue_enter() directly.

Cc: Bart Van Assche <Bart.VanAssche@wdc.com>
Suggested-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Ming Lei <ming.lei@redhat.com>
---
 block/blk-core.c       | 11 ++++++-----
 block/blk-mq.c         |  3 ++-
 block/blk-timeout.c    |  2 +-
 fs/block_dev.c         |  4 ++--
 include/linux/blkdev.h |  2 +-
 5 files changed, 12 insertions(+), 10 deletions(-)

diff --git a/block/blk-core.c b/block/blk-core.c
index 900eaa8eefa6..1bb566245d37 100644
--- a/block/blk-core.c
+++ b/block/blk-core.c
@@ -766,7 +766,7 @@ struct request_queue *blk_alloc_queue(gfp_t gfp_mask)
 }
 EXPORT_SYMBOL(blk_alloc_queue);
 
-int blk_queue_enter(struct request_queue *q, bool nowait)
+int blk_queue_enter(struct request_queue *q, unsigned int op)
 {
 	while (true) {
 		int ret;
@@ -774,7 +774,7 @@ int blk_queue_enter(struct request_queue *q, bool nowait)
 		if (percpu_ref_tryget_live(&q->q_usage_counter))
 			return 0;
 
-		if (nowait)
+		if (op & REQ_NOWAIT)
 			return -EBUSY;
 
 		/*
@@ -1408,8 +1408,8 @@ static struct request *blk_old_get_request(struct request_queue *q,
 	/* create ioc upfront */
 	create_io_context(gfp_mask, q->node);
 
-	ret = blk_queue_enter(q, !(gfp_mask & __GFP_DIRECT_RECLAIM) ||
-			(op & REQ_NOWAIT));
+	ret = blk_queue_enter(q, (gfp_mask & __GFP_DIRECT_RECLAIM) ? op :
+			op | REQ_NOWAIT);
 	if (ret)
 		return ERR_PTR(ret);
 	spin_lock_irq(q->queue_lock);
@@ -1436,6 +1436,7 @@ struct request *blk_get_request(struct request_queue *q, unsigned int op,
 		req = blk_mq_alloc_request(q, op,
 			(gfp_mask & __GFP_DIRECT_RECLAIM) ?
 				0 : BLK_MQ_REQ_NOWAIT);
+
 		if (!IS_ERR(req) && q->mq_ops->initialize_rq_fn)
 			q->mq_ops->initialize_rq_fn(req);
 	} else {
@@ -2216,7 +2217,7 @@ blk_qc_t generic_make_request(struct bio *bio)
 	do {
 		struct request_queue *q = bio->bi_disk->queue;
 
-		if (likely(blk_queue_enter(q, bio->bi_opf & REQ_NOWAIT) == 0)) {
+		if (likely(blk_queue_enter(q, bio->bi_opf) == 0)) {
 			struct bio_list lower, same;
 
 			/* Create a fresh bio_list for all subordinate requests */
diff --git a/block/blk-mq.c b/block/blk-mq.c
index 10c1f49f663d..bf89549074bb 100644
--- a/block/blk-mq.c
+++ b/block/blk-mq.c
@@ -384,7 +384,8 @@ struct request *blk_mq_alloc_request(struct request_queue *q, unsigned int op,
 	struct request *rq;
 	int ret;
 
-	ret = blk_queue_enter(q, flags & BLK_MQ_REQ_NOWAIT);
+	ret = blk_queue_enter(q, !(flags & BLK_MQ_REQ_NOWAIT) ? op :
+			op | REQ_NOWAIT);
 	if (ret)
 		return ERR_PTR(ret);
 
diff --git a/block/blk-timeout.c b/block/blk-timeout.c
index 17ec83bb0900..071c6de9154d 100644
--- a/block/blk-timeout.c
+++ b/block/blk-timeout.c
@@ -134,7 +134,7 @@ void blk_timeout_work(struct work_struct *work)
 	struct request *rq, *tmp;
 	int next_set = 0;
 
-	if (blk_queue_enter(q, true))
+	if (blk_queue_enter(q, REQ_NOWAIT))
 		return;
 	spin_lock_irqsave(q->queue_lock, flags);
 
diff --git a/fs/block_dev.c b/fs/block_dev.c
index 93d088ffc05c..98cf2d7ee9d3 100644
--- a/fs/block_dev.c
+++ b/fs/block_dev.c
@@ -674,7 +674,7 @@ int bdev_read_page(struct block_device *bdev, sector_t sector,
 	if (!ops->rw_page || bdev_get_integrity(bdev))
 		return result;
 
-	result = blk_queue_enter(bdev->bd_queue, false);
+	result = blk_queue_enter(bdev->bd_queue, 0);
 	if (result)
 		return result;
 	result = ops->rw_page(bdev, sector + get_start_sect(bdev), page, false);
@@ -710,7 +710,7 @@ int bdev_write_page(struct block_device *bdev, sector_t sector,
 
 	if (!ops->rw_page || bdev_get_integrity(bdev))
 		return -EOPNOTSUPP;
-	result = blk_queue_enter(bdev->bd_queue, false);
+	result = blk_queue_enter(bdev->bd_queue, 0);
 	if (result)
 		return result;
 
diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h
index ab6b6c0392c2..4c688385d866 100644
--- a/include/linux/blkdev.h
+++ b/include/linux/blkdev.h
@@ -960,7 +960,7 @@ extern int scsi_cmd_ioctl(struct request_queue *, struct gendisk *, fmode_t,
 extern int sg_scsi_ioctl(struct request_queue *, struct gendisk *, fmode_t,
 			 struct scsi_ioctl_command __user *);
 
-extern int blk_queue_enter(struct request_queue *q, bool nowait);
+extern int blk_queue_enter(struct request_queue *q, unsigned int op);
 extern void blk_queue_exit(struct request_queue *q);
 extern void blk_start_queue(struct request_queue *q);
 extern void blk_start_queue_async(struct request_queue *q);
-- 
2.9.5

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

* [PATCH V8 5/8] percpu-refcount: introduce __percpu_ref_tryget_live
  2017-10-03 14:03 [PATCH V8 0/8] block/scsi: safe SCSI quiescing Ming Lei
                   ` (3 preceding siblings ...)
  2017-10-03 14:04 ` [PATCH V8 4/8] block: pass 'op' to blk_queue_enter() Ming Lei
@ 2017-10-03 14:04 ` Ming Lei
  2017-10-03 14:14   ` Tejun Heo
  2017-10-03 18:40     ` Bart Van Assche
  2017-10-03 14:04 ` [PATCH V8 6/8] blk-mq: return if queue is frozen via current blk_freeze_queue_start Ming Lei
                   ` (4 subsequent siblings)
  9 siblings, 2 replies; 19+ messages in thread
From: Ming Lei @ 2017-10-03 14:04 UTC (permalink / raw)
  To: Jens Axboe, linux-block, Christoph Hellwig, linux-scsi,
	Martin K . Petersen, James E . J . Bottomley
  Cc: Bart Van Assche, Oleksandr Natalenko, Johannes Thumshirn,
	Cathy Avery, Martin Steigerwald, linux-kernel, Hannes Reinecke,
	Ming Lei, Bart Van Assche, Tejun Heo

Block layer need to call this function after holding
rcu lock in a real hot path, so introduce this helper.

Cc: Bart Van Assche <Bart.VanAssche@wdc.com>
Cc: Tejun Heo <tj@kernel.org>
Signed-off-by: Ming Lei <ming.lei@redhat.com>
---
 include/linux/percpu-refcount.h | 27 +++++++++++++++++----------
 1 file changed, 17 insertions(+), 10 deletions(-)

diff --git a/include/linux/percpu-refcount.h b/include/linux/percpu-refcount.h
index c13dceb87b60..a0f22586a28d 100644
--- a/include/linux/percpu-refcount.h
+++ b/include/linux/percpu-refcount.h
@@ -221,6 +221,21 @@ static inline bool percpu_ref_tryget(struct percpu_ref *ref)
 	return ret;
 }
 
+static inline bool __percpu_ref_tryget_live(struct percpu_ref *ref)
+{
+	unsigned long __percpu *percpu_count;
+	bool ret = false;
+
+	if (__ref_is_percpu(ref, &percpu_count)) {
+		this_cpu_inc(*percpu_count);
+		ret = true;
+	} else if (!(ref->percpu_count_ptr & __PERCPU_REF_DEAD)) {
+		ret = atomic_long_inc_not_zero(&ref->count);
+	}
+
+	return ret;
+}
+
 /**
  * percpu_ref_tryget_live - try to increment a live percpu refcount
  * @ref: percpu_ref to try-get
@@ -238,18 +253,10 @@ static inline bool percpu_ref_tryget(struct percpu_ref *ref)
  */
 static inline bool percpu_ref_tryget_live(struct percpu_ref *ref)
 {
-	unsigned long __percpu *percpu_count;
-	bool ret = false;
+	bool ret;
 
 	rcu_read_lock_sched();
-
-	if (__ref_is_percpu(ref, &percpu_count)) {
-		this_cpu_inc(*percpu_count);
-		ret = true;
-	} else if (!(ref->percpu_count_ptr & __PERCPU_REF_DEAD)) {
-		ret = atomic_long_inc_not_zero(&ref->count);
-	}
-
+	ret = __percpu_ref_tryget_live(ref);
 	rcu_read_unlock_sched();
 
 	return ret;
-- 
2.9.5

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

* [PATCH V8 6/8] blk-mq: return if queue is frozen via current blk_freeze_queue_start
  2017-10-03 14:03 [PATCH V8 0/8] block/scsi: safe SCSI quiescing Ming Lei
                   ` (4 preceding siblings ...)
  2017-10-03 14:04 ` [PATCH V8 5/8] percpu-refcount: introduce __percpu_ref_tryget_live Ming Lei
@ 2017-10-03 14:04 ` Ming Lei
  2017-10-03 14:04 ` [PATCH V8 7/8] block: support PREEMPT_ONLY Ming Lei
                   ` (3 subsequent siblings)
  9 siblings, 0 replies; 19+ messages in thread
From: Ming Lei @ 2017-10-03 14:04 UTC (permalink / raw)
  To: Jens Axboe, linux-block, Christoph Hellwig, linux-scsi,
	Martin K . Petersen, James E . J . Bottomley
  Cc: Bart Van Assche, Oleksandr Natalenko, Johannes Thumshirn,
	Cathy Avery, Martin Steigerwald, linux-kernel, Hannes Reinecke,
	Ming Lei, Bart Van Assche

We need this return value in the following patch to decide
if a explicit synchronize_rcu() is needed.

Cc: Bart Van Assche <Bart.VanAssche@wdc.com>
Signed-off-by: Ming Lei <ming.lei@redhat.com>
---
 block/blk-mq.c         | 13 ++++++++-----
 block/blk-mq.h         |  1 -
 block/blk.h            |  2 +-
 include/linux/blk-mq.h |  4 ++--
 4 files changed, 11 insertions(+), 9 deletions(-)

diff --git a/block/blk-mq.c b/block/blk-mq.c
index bf89549074bb..80d6dd99d7f1 100644
--- a/block/blk-mq.c
+++ b/block/blk-mq.c
@@ -118,7 +118,7 @@ void blk_mq_in_flight(struct request_queue *q, struct hd_struct *part,
 	blk_mq_queue_tag_busy_iter(q, blk_mq_check_inflight, &mi);
 }
 
-void blk_freeze_queue_start(struct request_queue *q)
+bool blk_freeze_queue_start(struct request_queue *q)
 {
 	int freeze_depth;
 
@@ -127,7 +127,9 @@ void blk_freeze_queue_start(struct request_queue *q)
 		percpu_ref_kill(&q->q_usage_counter);
 		if (q->mq_ops)
 			blk_mq_run_hw_queues(q, false);
+		return true;
 	}
+	return false;
 }
 EXPORT_SYMBOL_GPL(blk_freeze_queue_start);
 
@@ -150,7 +152,7 @@ EXPORT_SYMBOL_GPL(blk_mq_freeze_queue_wait_timeout);
  * Guarantee no request is in use, so we can change any data structure of
  * the queue afterward.
  */
-void blk_freeze_queue(struct request_queue *q)
+bool blk_freeze_queue(struct request_queue *q)
 {
 	/*
 	 * In the !blk_mq case we are only calling this to kill the
@@ -159,17 +161,18 @@ void blk_freeze_queue(struct request_queue *q)
 	 * no blk_unfreeze_queue(), and blk_freeze_queue() is not
 	 * exported to drivers as the only user for unfreeze is blk_mq.
 	 */
-	blk_freeze_queue_start(q);
+	bool ret = blk_freeze_queue_start(q);
 	blk_mq_freeze_queue_wait(q);
+	return ret;
 }
 
-void blk_mq_freeze_queue(struct request_queue *q)
+bool blk_mq_freeze_queue(struct request_queue *q)
 {
 	/*
 	 * ...just an alias to keep freeze and unfreeze actions balanced
 	 * in the blk_mq_* namespace
 	 */
-	blk_freeze_queue(q);
+	return blk_freeze_queue(q);
 }
 EXPORT_SYMBOL_GPL(blk_mq_freeze_queue);
 
diff --git a/block/blk-mq.h b/block/blk-mq.h
index ef15b3414da5..41044a8662ca 100644
--- a/block/blk-mq.h
+++ b/block/blk-mq.h
@@ -26,7 +26,6 @@ struct blk_mq_ctx {
 } ____cacheline_aligned_in_smp;
 
 void blk_mq_run_hw_queue(struct blk_mq_hw_ctx *hctx, bool async);
-void blk_mq_freeze_queue(struct request_queue *q);
 void blk_mq_free_queue(struct request_queue *q);
 int blk_mq_update_nr_requests(struct request_queue *q, unsigned int nr);
 void blk_mq_wake_waiters(struct request_queue *q);
diff --git a/block/blk.h b/block/blk.h
index fcb9775b997d..fa1b33d3fcbd 100644
--- a/block/blk.h
+++ b/block/blk.h
@@ -65,7 +65,7 @@ void blk_rq_bio_prep(struct request_queue *q, struct request *rq,
 void blk_queue_bypass_start(struct request_queue *q);
 void blk_queue_bypass_end(struct request_queue *q);
 void __blk_queue_free_tags(struct request_queue *q);
-void blk_freeze_queue(struct request_queue *q);
+bool blk_freeze_queue(struct request_queue *q);
 
 static inline void blk_queue_enter_live(struct request_queue *q)
 {
diff --git a/include/linux/blk-mq.h b/include/linux/blk-mq.h
index 50c6485cb04f..d6195925e6c3 100644
--- a/include/linux/blk-mq.h
+++ b/include/linux/blk-mq.h
@@ -253,9 +253,9 @@ void blk_mq_run_hw_queues(struct request_queue *q, bool async);
 void blk_mq_delay_queue(struct blk_mq_hw_ctx *hctx, unsigned long msecs);
 void blk_mq_tagset_busy_iter(struct blk_mq_tag_set *tagset,
 		busy_tag_iter_fn *fn, void *priv);
-void blk_mq_freeze_queue(struct request_queue *q);
+bool blk_mq_freeze_queue(struct request_queue *q);
 void blk_mq_unfreeze_queue(struct request_queue *q);
-void blk_freeze_queue_start(struct request_queue *q);
+bool blk_freeze_queue_start(struct request_queue *q);
 void blk_mq_freeze_queue_wait(struct request_queue *q);
 int blk_mq_freeze_queue_wait_timeout(struct request_queue *q,
 				     unsigned long timeout);
-- 
2.9.5

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

* [PATCH V8 7/8] block: support PREEMPT_ONLY
  2017-10-03 14:03 [PATCH V8 0/8] block/scsi: safe SCSI quiescing Ming Lei
                   ` (5 preceding siblings ...)
  2017-10-03 14:04 ` [PATCH V8 6/8] blk-mq: return if queue is frozen via current blk_freeze_queue_start Ming Lei
@ 2017-10-03 14:04 ` Ming Lei
  2017-10-03 14:04 ` [PATCH V8 8/8] SCSI: set block queue at preempt only when SCSI device is put into quiesce Ming Lei
                   ` (2 subsequent siblings)
  9 siblings, 0 replies; 19+ messages in thread
From: Ming Lei @ 2017-10-03 14:04 UTC (permalink / raw)
  To: Jens Axboe, linux-block, Christoph Hellwig, linux-scsi,
	Martin K . Petersen, James E . J . Bottomley
  Cc: Bart Van Assche, Oleksandr Natalenko, Johannes Thumshirn,
	Cathy Avery, Martin Steigerwald, linux-kernel, Hannes Reinecke,
	Ming Lei, Bart Van Assche

When queue is in PREEMPT_ONLY mode, only REQ_PREEMPT request
can be allocated and dispatched, other requests won't be allowed
to enter I/O path.

This is useful for supporting safe SCSI quiesce.

Part of this patch is from Bart's '[PATCH v4 4∕7] block: Add the QUEUE_FLAG_PREEMPT_ONLY
request queue flag'.

Tested-by: Oleksandr Natalenko <oleksandr@natalenko.name>
Tested-by: Martin Steigerwald <martin@lichtvoll.de>
Cc: Bart Van Assche <Bart.VanAssche@wdc.com>
Signed-off-by: Ming Lei <ming.lei@redhat.com>
---
 block/blk-core.c       | 44 +++++++++++++++++++++++++++++++++++++++++---
 include/linux/blkdev.h |  5 +++++
 2 files changed, 46 insertions(+), 3 deletions(-)

diff --git a/block/blk-core.c b/block/blk-core.c
index 1bb566245d37..7849cc1687bc 100644
--- a/block/blk-core.c
+++ b/block/blk-core.c
@@ -346,6 +346,34 @@ void blk_sync_queue(struct request_queue *q)
 }
 EXPORT_SYMBOL(blk_sync_queue);
 
+void blk_set_preempt_only(struct request_queue *q, bool preempt_only)
+{
+	unsigned long flags;
+
+	spin_lock_irqsave(q->queue_lock, flags);
+	if (preempt_only)
+		queue_flag_set(QUEUE_FLAG_PREEMPT_ONLY, q);
+	else
+		queue_flag_clear(QUEUE_FLAG_PREEMPT_ONLY, q);
+	spin_unlock_irqrestore(q->queue_lock, flags);
+
+	/*
+	 * The synchronize_rcu() implicied in blk_mq_freeze_queue()
+	 * or the explicit one will make sure the above write on
+	 * PREEMPT_ONLY is observed in blk_queue_enter() before
+	 * running blk_mq_unfreeze_queue().
+	 *
+	 * blk_mq_freeze_queue() also drains up any request in queue,
+	 * so blk_queue_enter() will see the above updated value of
+	 * PREEMPT flag before any new allocation.
+	 */
+	if (!blk_mq_freeze_queue(q))
+		synchronize_rcu();
+
+	blk_mq_unfreeze_queue(q);
+}
+EXPORT_SYMBOL(blk_set_preempt_only);
+
 /**
  * __blk_run_queue_uncond - run a queue whether or not it has been stopped
  * @q:	The queue to run
@@ -771,8 +799,16 @@ int blk_queue_enter(struct request_queue *q, unsigned int op)
 	while (true) {
 		int ret;
 
-		if (percpu_ref_tryget_live(&q->q_usage_counter))
-			return 0;
+		rcu_read_lock_sched();
+		if (__percpu_ref_tryget_live(&q->q_usage_counter)) {
+			if (likely((op & REQ_PREEMPT) ||
+						!blk_queue_preempt_only(q))) {
+				rcu_read_unlock_sched();
+				return 0;
+			} else
+				percpu_ref_put(&q->q_usage_counter);
+		}
+		rcu_read_unlock_sched();
 
 		if (op & REQ_NOWAIT)
 			return -EBUSY;
@@ -787,7 +823,9 @@ int blk_queue_enter(struct request_queue *q, unsigned int op)
 		smp_rmb();
 
 		ret = wait_event_interruptible(q->mq_freeze_wq,
-				!atomic_read(&q->mq_freeze_depth) ||
+				(!atomic_read(&q->mq_freeze_depth) &&
+				((op & REQ_PREEMPT) ||
+				 !blk_queue_preempt_only(q))) ||
 				blk_queue_dying(q));
 		if (blk_queue_dying(q))
 			return -ENODEV;
diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h
index 4c688385d866..66d46d9eac29 100644
--- a/include/linux/blkdev.h
+++ b/include/linux/blkdev.h
@@ -628,6 +628,7 @@ struct request_queue {
 #define QUEUE_FLAG_REGISTERED  26	/* queue has been registered to a disk */
 #define QUEUE_FLAG_SCSI_PASSTHROUGH 27	/* queue supports SCSI commands */
 #define QUEUE_FLAG_QUIESCED    28	/* queue has been quiesced */
+#define QUEUE_FLAG_PREEMPT_ONLY	29	/* only process REQ_PREEMPT requests */
 
 #define QUEUE_FLAG_DEFAULT	((1 << QUEUE_FLAG_IO_STAT) |		\
 				 (1 << QUEUE_FLAG_STACKABLE)	|	\
@@ -732,6 +733,10 @@ static inline void queue_flag_clear(unsigned int flag, struct request_queue *q)
 	((rq)->cmd_flags & (REQ_FAILFAST_DEV|REQ_FAILFAST_TRANSPORT| \
 			     REQ_FAILFAST_DRIVER))
 #define blk_queue_quiesced(q)	test_bit(QUEUE_FLAG_QUIESCED, &(q)->queue_flags)
+#define blk_queue_preempt_only(q)				\
+	test_bit(QUEUE_FLAG_PREEMPT_ONLY, &(q)->queue_flags)
+
+extern void blk_set_preempt_only(struct request_queue *q, bool preempt_only);
 
 static inline bool blk_account_rq(struct request *rq)
 {
-- 
2.9.5

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

* [PATCH V8 8/8] SCSI: set block queue at preempt only when SCSI device is put into quiesce
  2017-10-03 14:03 [PATCH V8 0/8] block/scsi: safe SCSI quiescing Ming Lei
                   ` (6 preceding siblings ...)
  2017-10-03 14:04 ` [PATCH V8 7/8] block: support PREEMPT_ONLY Ming Lei
@ 2017-10-03 14:04 ` Ming Lei
  2017-10-03 18:27   ` Oleksandr Natalenko
  2017-11-07 12:32 ` Oleksandr Natalenko
  9 siblings, 0 replies; 19+ messages in thread
From: Ming Lei @ 2017-10-03 14:04 UTC (permalink / raw)
  To: Jens Axboe, linux-block, Christoph Hellwig, linux-scsi,
	Martin K . Petersen, James E . J . Bottomley
  Cc: Bart Van Assche, Oleksandr Natalenko, Johannes Thumshirn,
	Cathy Avery, Martin Steigerwald, linux-kernel, Hannes Reinecke,
	Ming Lei, stable, Bart Van Assche

Simply quiesing SCSI device and waiting for completeion of IO
dispatched to SCSI queue isn't safe, it is easy to use up
request pool because all allocated requests before can't
be dispatched when device is put in QIUESCE. Then no request
can be allocated for RQF_PREEMPT, and system may hang somewhere,
such as When sending commands of sync_cache or start_stop during
system suspend path.

Before quiesing SCSI, this patch sets block queue in preempt
mode first, so no new normal request can enter queue any more,
and all pending requests are drained too once blk_set_preempt_only(true)
is returned. Then RQF_PREEMPT can be allocated successfully duirng
SCSI quiescing.

This patch fixes one long term issue of IO hang, in either block legacy
and blk-mq.

Tested-by: Oleksandr Natalenko <oleksandr@natalenko.name>
Tested-by: Martin Steigerwald <martin@lichtvoll.de>
Cc: stable@vger.kernel.org
Cc: Bart Van Assche <Bart.VanAssche@wdc.com>
Signed-off-by: Ming Lei <ming.lei@redhat.com>
---
 drivers/scsi/scsi_lib.c | 20 +++++++++++++++++++-
 1 file changed, 19 insertions(+), 1 deletion(-)

diff --git a/drivers/scsi/scsi_lib.c b/drivers/scsi/scsi_lib.c
index 62f905b22821..f7ffd33a283c 100644
--- a/drivers/scsi/scsi_lib.c
+++ b/drivers/scsi/scsi_lib.c
@@ -2929,12 +2929,28 @@ scsi_device_quiesce(struct scsi_device *sdev)
 {
 	int err;
 
+	/*
+	 * Simply quiesing SCSI device isn't safe, it is easy
+	 * to use up requests because all these allocated requests
+	 * can't be dispatched when device is put in QIUESCE.
+	 * Then no request can be allocated and we may hang
+	 * somewhere, such as system suspend/resume.
+	 *
+	 * So we set block queue in preempt only first, no new
+	 * normal request can enter queue any more, and all pending
+	 * requests are drained once blk_set_preempt_only()
+	 * returns. Only RQF_PREEMPT is allowed in preempt only mode.
+	 */
+	blk_set_preempt_only(sdev->request_queue, true);
+
 	mutex_lock(&sdev->state_mutex);
 	err = scsi_device_set_state(sdev, SDEV_QUIESCE);
 	mutex_unlock(&sdev->state_mutex);
 
-	if (err)
+	if (err) {
+		blk_set_preempt_only(sdev->request_queue, false);
 		return err;
+	}
 
 	scsi_run_queue(sdev->request_queue);
 	while (atomic_read(&sdev->device_busy)) {
@@ -2965,6 +2981,8 @@ void scsi_device_resume(struct scsi_device *sdev)
 	    scsi_device_set_state(sdev, SDEV_RUNNING) == 0)
 		scsi_run_queue(sdev->request_queue);
 	mutex_unlock(&sdev->state_mutex);
+
+	blk_set_preempt_only(sdev->request_queue, false);
 }
 EXPORT_SYMBOL(scsi_device_resume);
 
-- 
2.9.5

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

* Re: [PATCH V8 5/8] percpu-refcount: introduce __percpu_ref_tryget_live
  2017-10-03 14:04 ` [PATCH V8 5/8] percpu-refcount: introduce __percpu_ref_tryget_live Ming Lei
@ 2017-10-03 14:14   ` Tejun Heo
  2017-10-03 19:20     ` Ming Lei
  2017-10-03 18:40     ` Bart Van Assche
  1 sibling, 1 reply; 19+ messages in thread
From: Tejun Heo @ 2017-10-03 14:14 UTC (permalink / raw)
  To: Ming Lei
  Cc: Jens Axboe, linux-block, Christoph Hellwig, linux-scsi,
	Martin K . Petersen, James E . J . Bottomley, Bart Van Assche,
	Oleksandr Natalenko, Johannes Thumshirn, Cathy Avery,
	Martin Steigerwald, linux-kernel, Hannes Reinecke,
	Bart Van Assche

Hello,

On Tue, Oct 03, 2017 at 10:04:03PM +0800, Ming Lei wrote:
> Block layer need to call this function after holding
> rcu lock in a real hot path, so introduce this helper.

The patch description is too anemic.  It doesn't even describe what
changes are being made, let alone justifying them.

Thanks.

-- 
tejun

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

* Re: [PATCH V8 0/8] block/scsi: safe SCSI quiescing
  2017-10-03 14:03 [PATCH V8 0/8] block/scsi: safe SCSI quiescing Ming Lei
@ 2017-10-03 18:27   ` Oleksandr Natalenko
  2017-10-03 14:04 ` [PATCH V8 2/8] block: tracking request allocation with q_usage_counter Ming Lei
                     ` (8 subsequent siblings)
  9 siblings, 0 replies; 19+ messages in thread
From: Oleksandr Natalenko @ 2017-10-03 18:27 UTC (permalink / raw)
  To: Ming Lei
  Cc: Jens Axboe, linux-block, Christoph Hellwig, linux-scsi,
	Martin K . Petersen, James E . J . Bottomley, Bart Van Assche,
	Johannes Thumshirn, Cathy Avery, Martin Steigerwald,
	linux-kernel, Hannes Reinecke

Also

Tested-by: Oleksandr Natalenko <oleksandr@natalenko.name>

for whole v8.

On =C3=BAter=C3=BD 3. =C5=99=C3=ADjna 2017 16:03:58 CEST Ming Lei wrote:
> Hi Jens,
>=20
> Please consider this patchset for V4.15, and it fixes one
> kind of long-term I/O hang issue in either block legacy path
> or blk-mq.
>=20
> The current SCSI quiesce isn't safe and easy to trigger I/O deadlock.
>=20
> 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.
>=20
> Because new request still can be comming, but all the allocated
> requests can't be dispatched successfully, so request pool can be
> consumed up easily.
>=20
> Then request with RQF_PREEMPT can't be allocated and wait forever,
> then system hangs forever, such as during system suspend or
> sending SCSI domain alidation in case of transport_spi.
>=20
> Both IO hang inside system suspend[1] or SCSI domain validation
> were reported before.
>=20
> This patch introduces preempt only mode, and solves the issue
> by allowing RQF_PREEMP only during SCSI quiesce.
>=20
> Both SCSI and SCSI_MQ have this IO deadlock issue, this patch fixes
> them all.
>=20
> V8:
> 	- fix one race as pointed out by Bart
> 	- pass 'op' to blk_queue_enter() as suggested by Christoph
>=20
> V7:
> 	- add Reviewed-by & Tested-by
> 	- one line change in patch 5 for checking preempt request
>=20
> V6:
> 	- borrow Bart's idea of preempt only, with clean
> 	  implementation(patch 5/patch 6)
> 	- needn't any external driver's dependency, such as MD's
> 	change
>=20
> V5:
> 	- fix one tiny race by introducing blk_queue_enter_preempt_freeze()
> 	given this change is small enough compared with V4, I added
> 	tested-by directly
>=20
> V4:
> 	- reorganize patch order to make it more reasonable
> 	- support nested preempt freeze, as required by SCSI transport spi
> 	- check preempt freezing in slow path of of blk_queue_enter()
> 	- add "SCSI: transport_spi: resume a quiesced device"
> 	- wake up freeze queue in setting dying for both blk-mq and legacy
> 	- rename blk_mq_[freeze|unfreeze]_queue() in one patch
> 	- rename .mq_freeze_wq and .mq_freeze_depth
> 	- improve comment
>=20
> V3:
> 	- introduce q->preempt_unfreezing to fix one bug of preempt freeze
> 	- call blk_queue_enter_live() only when queue is preempt frozen
> 	- cleanup a bit on the implementation of preempt freeze
> 	- only patch 6 and 7 are changed
>=20
> 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
>=20
>=20
> [1] https://marc.info/?t=3D150340250100013&r=3D3&w=3D2
>=20
>=20
> Thanks,
> Ming
>=20
> Bart Van Assche (1):
>   block: Convert RQF_PREEMPT into REQ_PREEMPT
>=20
> Ming Lei (7):
>   blk-mq: only run hw queues for blk-mq
>   block: tracking request allocation with q_usage_counter
>   block: pass 'op' to blk_queue_enter()
>   percpu-refcount: introduce __percpu_ref_tryget_live
>   blk-mq: return if queue is frozen via current blk_freeze_queue_start
>   block: support PREEMPT_ONLY
>   SCSI: set block queue at preempt only when SCSI device is put into
>     quiesce
>=20
>  block/blk-core.c                | 66
> +++++++++++++++++++++++++++++++++++++---- block/blk-mq-debugfs.c         =
 |
>  2 +-
>  block/blk-mq.c                  | 26 ++++++++--------
>  block/blk-mq.h                  |  1 -
>  block/blk-timeout.c             |  2 +-
>  block/blk.h                     |  2 +-
>  drivers/ide/ide-atapi.c         |  3 +-
>  drivers/ide/ide-io.c            |  2 +-
>  drivers/ide/ide-pm.c            |  4 +--
>  drivers/scsi/scsi_lib.c         | 31 +++++++++++++++----
>  fs/block_dev.c                  |  4 +--
>  include/linux/blk-mq.h          |  4 +--
>  include/linux/blk_types.h       |  6 ++++
>  include/linux/blkdev.h          | 10 ++++---
>  include/linux/percpu-refcount.h | 27 ++++++++++-------
>  15 files changed, 137 insertions(+), 53 deletions(-)

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

* Re: [PATCH V8 0/8] block/scsi: safe SCSI quiescing
@ 2017-10-03 18:27   ` Oleksandr Natalenko
  0 siblings, 0 replies; 19+ messages in thread
From: Oleksandr Natalenko @ 2017-10-03 18:27 UTC (permalink / raw)
  To: Ming Lei
  Cc: Jens Axboe, linux-block, Christoph Hellwig, linux-scsi,
	Martin K . Petersen, James E . J . Bottomley, Bart Van Assche,
	Johannes Thumshirn, Cathy Avery, Martin Steigerwald,
	linux-kernel, Hannes Reinecke

Also

Tested-by: Oleksandr Natalenko <oleksandr@natalenko.name>

for whole v8.

On úterý 3. října 2017 16:03:58 CEST Ming Lei wrote:
> Hi Jens,
> 
> Please consider this patchset for V4.15, and it fixes one
> kind of long-term I/O hang issue in either block legacy path
> or blk-mq.
> 
> 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 comming, 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 wait forever,
> then system hangs forever, such as during system suspend or
> sending SCSI domain alidation in case of transport_spi.
> 
> Both IO hang inside system suspend[1] or SCSI domain validation
> were reported before.
> 
> This patch introduces preempt only mode, and solves the issue
> by allowing RQF_PREEMP only during SCSI quiesce.
> 
> Both SCSI and SCSI_MQ have this IO deadlock issue, this patch fixes
> them all.
> 
> V8:
> 	- fix one race as pointed out by Bart
> 	- pass 'op' to blk_queue_enter() as suggested by Christoph
> 
> V7:
> 	- add Reviewed-by & Tested-by
> 	- one line change in patch 5 for checking preempt request
> 
> V6:
> 	- borrow Bart's idea of preempt only, with clean
> 	  implementation(patch 5/patch 6)
> 	- needn't any external driver's dependency, such as MD's
> 	change
> 
> V5:
> 	- fix one tiny race by introducing blk_queue_enter_preempt_freeze()
> 	given this change is small enough compared with V4, I added
> 	tested-by directly
> 
> V4:
> 	- reorganize patch order to make it more reasonable
> 	- support nested preempt freeze, as required by SCSI transport spi
> 	- check preempt freezing in slow path of of blk_queue_enter()
> 	- add "SCSI: transport_spi: resume a quiesced device"
> 	- wake up freeze queue in setting dying for both blk-mq and legacy
> 	- rename blk_mq_[freeze|unfreeze]_queue() in one patch
> 	- rename .mq_freeze_wq and .mq_freeze_depth
> 	- improve comment
> 
> V3:
> 	- introduce q->preempt_unfreezing to fix one bug of preempt freeze
> 	- call blk_queue_enter_live() only when queue is preempt frozen
> 	- cleanup a bit on the implementation of preempt freeze
> 	- only patch 6 and 7 are changed
> 
> 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
> 
> 
> Thanks,
> Ming
> 
> Bart Van Assche (1):
>   block: Convert RQF_PREEMPT into REQ_PREEMPT
> 
> Ming Lei (7):
>   blk-mq: only run hw queues for blk-mq
>   block: tracking request allocation with q_usage_counter
>   block: pass 'op' to blk_queue_enter()
>   percpu-refcount: introduce __percpu_ref_tryget_live
>   blk-mq: return if queue is frozen via current blk_freeze_queue_start
>   block: support PREEMPT_ONLY
>   SCSI: set block queue at preempt only when SCSI device is put into
>     quiesce
> 
>  block/blk-core.c                | 66
> +++++++++++++++++++++++++++++++++++++---- block/blk-mq-debugfs.c          |
>  2 +-
>  block/blk-mq.c                  | 26 ++++++++--------
>  block/blk-mq.h                  |  1 -
>  block/blk-timeout.c             |  2 +-
>  block/blk.h                     |  2 +-
>  drivers/ide/ide-atapi.c         |  3 +-
>  drivers/ide/ide-io.c            |  2 +-
>  drivers/ide/ide-pm.c            |  4 +--
>  drivers/scsi/scsi_lib.c         | 31 +++++++++++++++----
>  fs/block_dev.c                  |  4 +--
>  include/linux/blk-mq.h          |  4 +--
>  include/linux/blk_types.h       |  6 ++++
>  include/linux/blkdev.h          | 10 ++++---
>  include/linux/percpu-refcount.h | 27 ++++++++++-------
>  15 files changed, 137 insertions(+), 53 deletions(-)

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

* Re: [PATCH V8 5/8] percpu-refcount: introduce __percpu_ref_tryget_live
  2017-10-03 14:04 ` [PATCH V8 5/8] percpu-refcount: introduce __percpu_ref_tryget_live Ming Lei
@ 2017-10-03 18:40     ` Bart Van Assche
  2017-10-03 18:40     ` Bart Van Assche
  1 sibling, 0 replies; 19+ messages in thread
From: Bart Van Assche @ 2017-10-03 18:40 UTC (permalink / raw)
  To: linux-scsi, hch, jejb, linux-block, axboe, ming.lei, martin.petersen
  Cc: linux-kernel, jthumshirn, martin, Bart Van Assche, oleksandr,
	hare, tj, cavery

T24gVHVlLCAyMDE3LTEwLTAzIGF0IDIyOjA0ICswODAwLCBNaW5nIExlaSB3cm90ZToNCj4gQmxv
Y2sgbGF5ZXIgbmVlZCB0byBjYWxsIHRoaXMgZnVuY3Rpb24gYWZ0ZXIgaG9sZGluZw0KPiByY3Ug
bG9jayBpbiBhIHJlYWwgaG90IHBhdGgsIHNvIGludHJvZHVjZSB0aGlzIGhlbHBlci4NCg0KU2lu
Y2UgaXQgaXMgYWxsb3dlZCB0byBuZXN0IHJjdV9yZWFkX2xvY2tfc2NoZWQoKSBjYWxscyBJIGRv
bid0IHRoaW5rDQp0aGF0IHRoaXMgcGF0Y2ggaXMgbmVjZXNzYXJ5Lg0KDQpCYXJ0Lg==

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

* Re: [PATCH V8 5/8] percpu-refcount: introduce __percpu_ref_tryget_live
@ 2017-10-03 18:40     ` Bart Van Assche
  0 siblings, 0 replies; 19+ messages in thread
From: Bart Van Assche @ 2017-10-03 18:40 UTC (permalink / raw)
  To: linux-scsi, hch, jejb, linux-block, axboe, ming.lei, martin.petersen
  Cc: linux-kernel, jthumshirn, martin, Bart Van Assche, oleksandr,
	hare, tj, cavery

On Tue, 2017-10-03 at 22:04 +0800, Ming Lei wrote:
> Block layer need to call this function after holding
> rcu lock in a real hot path, so introduce this helper.

Since it is allowed to nest rcu_read_lock_sched() calls I don't think
that this patch is necessary.

Bart.

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

* Re: [PATCH V8 5/8] percpu-refcount: introduce __percpu_ref_tryget_live
  2017-10-03 14:14   ` Tejun Heo
@ 2017-10-03 19:20     ` Ming Lei
  2017-10-03 19:31       ` Tejun Heo
  0 siblings, 1 reply; 19+ messages in thread
From: Ming Lei @ 2017-10-03 19:20 UTC (permalink / raw)
  To: Tejun Heo
  Cc: Jens Axboe, linux-block, Christoph Hellwig, linux-scsi,
	Martin K . Petersen, James E . J . Bottomley, Bart Van Assche,
	Oleksandr Natalenko, Johannes Thumshirn, Cathy Avery,
	Martin Steigerwald, linux-kernel, Hannes Reinecke,
	Bart Van Assche

On Tue, Oct 03, 2017 at 07:14:59AM -0700, Tejun Heo wrote:
> Hello,
> 
> On Tue, Oct 03, 2017 at 10:04:03PM +0800, Ming Lei wrote:
> > Block layer need to call this function after holding
> > rcu lock in a real hot path, so introduce this helper.
> 
> The patch description is too anemic.  It doesn't even describe what
> changes are being made, let alone justifying them.

Sorry for Cc you, and this change is needed by the following
patch:

	https://marc.info/?l=linux-scsi&m=150703956929333&w=2

Block layer need to call percpu_ref_tryget_live()
with holding RCU read lock, given it is a hot I/O
path, that is why I make this patch so that we can
avoid nested RCU read lock and save a bit cost.

--
Ming

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

* Re: [PATCH V8 5/8] percpu-refcount: introduce __percpu_ref_tryget_live
  2017-10-03 18:40     ` Bart Van Assche
  (?)
@ 2017-10-03 19:24     ` Ming Lei
  -1 siblings, 0 replies; 19+ messages in thread
From: Ming Lei @ 2017-10-03 19:24 UTC (permalink / raw)
  To: Bart Van Assche
  Cc: linux-scsi, hch, jejb, linux-block, axboe, martin.petersen,
	linux-kernel, jthumshirn, martin, oleksandr, hare, tj, cavery

On Tue, Oct 03, 2017 at 06:40:24PM +0000, Bart Van Assche wrote:
> On Tue, 2017-10-03 at 22:04 +0800, Ming Lei wrote:
> > Block layer need to call this function after holding
> > rcu lock in a real hot path, so introduce this helper.
> 
> Since it is allowed to nest rcu_read_lock_sched() calls I don't think
> that this patch is necessary.

Yeah, I know that, with this patch, we can avoid the nest RCU lock.
As I mentioned, it is a real hot path, so maybe better to not
introduce the extra RCU read lock/unlock.

If you guys doesn't care the little cost, I can remove that.

-- 
Ming

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

* Re: [PATCH V8 5/8] percpu-refcount: introduce __percpu_ref_tryget_live
  2017-10-03 19:20     ` Ming Lei
@ 2017-10-03 19:31       ` Tejun Heo
  0 siblings, 0 replies; 19+ messages in thread
From: Tejun Heo @ 2017-10-03 19:31 UTC (permalink / raw)
  To: Ming Lei
  Cc: Jens Axboe, linux-block, Christoph Hellwig, linux-scsi,
	Martin K . Petersen, James E . J . Bottomley, Bart Van Assche,
	Oleksandr Natalenko, Johannes Thumshirn, Cathy Avery,
	Martin Steigerwald, linux-kernel, Hannes Reinecke,
	Bart Van Assche

Hello,

On Wed, Oct 04, 2017 at 03:20:40AM +0800, Ming Lei wrote:
> On Tue, Oct 03, 2017 at 07:14:59AM -0700, Tejun Heo wrote:
> > Hello,
> > 
> > On Tue, Oct 03, 2017 at 10:04:03PM +0800, Ming Lei wrote:
> > > Block layer need to call this function after holding
> > > rcu lock in a real hot path, so introduce this helper.
> > 
> > The patch description is too anemic.  It doesn't even describe what
> > changes are being made, let alone justifying them.
> 
> Sorry for Cc you, and this change is needed by the following
> patch:
> 
> 	https://marc.info/?l=linux-scsi&m=150703956929333&w=2
> 
> Block layer need to call percpu_ref_tryget_live()
> with holding RCU read lock, given it is a hot I/O
> path, that is why I make this patch so that we can
> avoid nested RCU read lock and save a bit cost.

I'm not necessarily against it but please name it sth like
percpu_ref_tryget_live_locked(), add lockdep assertions in the inner
function and document properly.

Thanks.

-- 
tejun

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

* Re: [PATCH V8 0/8] block/scsi: safe SCSI quiescing
  2017-10-03 14:03 [PATCH V8 0/8] block/scsi: safe SCSI quiescing Ming Lei
                   ` (8 preceding siblings ...)
  2017-10-03 18:27   ` Oleksandr Natalenko
@ 2017-11-07 12:32 ` Oleksandr Natalenko
  2017-11-07 13:17   ` Ming Lei
  9 siblings, 1 reply; 19+ messages in thread
From: Oleksandr Natalenko @ 2017-11-07 12:32 UTC (permalink / raw)
  To: Ming Lei
  Cc: Jens Axboe, linux-block, Christoph Hellwig, linux-scsi,
	Martin K . Petersen, James E . J . Bottomley, Bart Van Assche,
	Johannes Thumshirn, Cathy Avery, Martin Steigerwald,
	linux-kernel, Hannes Reinecke

Hi Ming, Jens.

What is the fate of this patchset please?

03.10.2017 16:03, Ming Lei wrote:
> Hi Jens,
> 
> Please consider this patchset for V4.15, and it fixes one
> kind of long-term I/O hang issue in either block legacy path
> or blk-mq.
> 
> 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 comming, 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 wait forever,
> then system hangs forever, such as during system suspend or
> sending SCSI domain alidation in case of transport_spi.
> 
> Both IO hang inside system suspend[1] or SCSI domain validation
> were reported before.
> 
> This patch introduces preempt only mode, and solves the issue
> by allowing RQF_PREEMP only during SCSI quiesce.
> 
> Both SCSI and SCSI_MQ have this IO deadlock issue, this patch fixes
> them all.
> 
> V8:
> 	- fix one race as pointed out by Bart
> 	- pass 'op' to blk_queue_enter() as suggested by Christoph
> 
> V7:
> 	- add Reviewed-by & Tested-by
> 	- one line change in patch 5 for checking preempt request
> 
> V6:
> 	- borrow Bart's idea of preempt only, with clean
> 	  implementation(patch 5/patch 6)
> 	- needn't any external driver's dependency, such as MD's
> 	change
> 
> V5:
> 	- fix one tiny race by introducing blk_queue_enter_preempt_freeze()
> 	given this change is small enough compared with V4, I added
> 	tested-by directly
> 
> V4:
> 	- reorganize patch order to make it more reasonable
> 	- support nested preempt freeze, as required by SCSI transport spi
> 	- check preempt freezing in slow path of of blk_queue_enter()
> 	- add "SCSI: transport_spi: resume a quiesced device"
> 	- wake up freeze queue in setting dying for both blk-mq and legacy
> 	- rename blk_mq_[freeze|unfreeze]_queue() in one patch
> 	- rename .mq_freeze_wq and .mq_freeze_depth
> 	- improve comment
> 
> V3:
> 	- introduce q->preempt_unfreezing to fix one bug of preempt freeze
> 	- call blk_queue_enter_live() only when queue is preempt frozen
> 	- cleanup a bit on the implementation of preempt freeze
> 	- only patch 6 and 7 are changed
> 
> 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
> 
> 
> Thanks,
> Ming
> 
> Bart Van Assche (1):
>   block: Convert RQF_PREEMPT into REQ_PREEMPT
> 
> Ming Lei (7):
>   blk-mq: only run hw queues for blk-mq
>   block: tracking request allocation with q_usage_counter
>   block: pass 'op' to blk_queue_enter()
>   percpu-refcount: introduce __percpu_ref_tryget_live
>   blk-mq: return if queue is frozen via current blk_freeze_queue_start
>   block: support PREEMPT_ONLY
>   SCSI: set block queue at preempt only when SCSI device is put into
>     quiesce
> 
>  block/blk-core.c                | 66 
> +++++++++++++++++++++++++++++++++++++----
>  block/blk-mq-debugfs.c          |  2 +-
>  block/blk-mq.c                  | 26 ++++++++--------
>  block/blk-mq.h                  |  1 -
>  block/blk-timeout.c             |  2 +-
>  block/blk.h                     |  2 +-
>  drivers/ide/ide-atapi.c         |  3 +-
>  drivers/ide/ide-io.c            |  2 +-
>  drivers/ide/ide-pm.c            |  4 +--
>  drivers/scsi/scsi_lib.c         | 31 +++++++++++++++----
>  fs/block_dev.c                  |  4 +--
>  include/linux/blk-mq.h          |  4 +--
>  include/linux/blk_types.h       |  6 ++++
>  include/linux/blkdev.h          | 10 ++++---
>  include/linux/percpu-refcount.h | 27 ++++++++++-------
>  15 files changed, 137 insertions(+), 53 deletions(-)

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

* Re: [PATCH V8 0/8] block/scsi: safe SCSI quiescing
  2017-11-07 12:32 ` Oleksandr Natalenko
@ 2017-11-07 13:17   ` Ming Lei
  0 siblings, 0 replies; 19+ messages in thread
From: Ming Lei @ 2017-11-07 13:17 UTC (permalink / raw)
  To: Oleksandr Natalenko
  Cc: Jens Axboe, linux-block, Christoph Hellwig, linux-scsi,
	Martin K . Petersen, James E . J . Bottomley, Bart Van Assche,
	Johannes Thumshirn, Cathy Avery, Martin Steigerwald,
	linux-kernel, Hannes Reinecke

On Tue, Nov 07, 2017 at 01:32:44PM +0100, Oleksandr Natalenko wrote:
> Hi Ming, Jens.
> 
> What is the fate of this patchset please?

Hi Oleksandr,

Recently Bart is working on this patchset, and you may try to see
if his V11 works for you:

	https://marc.info/?t=150940351000009&r=1&w=2

Thanks,
Ming

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

end of thread, other threads:[~2017-11-07 13:17 UTC | newest]

Thread overview: 19+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-10-03 14:03 [PATCH V8 0/8] block/scsi: safe SCSI quiescing Ming Lei
2017-10-03 14:03 ` [PATCH V8 1/8] blk-mq: only run hw queues for blk-mq Ming Lei
2017-10-03 14:04 ` [PATCH V8 2/8] block: tracking request allocation with q_usage_counter Ming Lei
2017-10-03 14:04 ` [PATCH V8 3/8] block: Convert RQF_PREEMPT into REQ_PREEMPT Ming Lei
2017-10-03 14:04 ` [PATCH V8 4/8] block: pass 'op' to blk_queue_enter() Ming Lei
2017-10-03 14:04 ` [PATCH V8 5/8] percpu-refcount: introduce __percpu_ref_tryget_live Ming Lei
2017-10-03 14:14   ` Tejun Heo
2017-10-03 19:20     ` Ming Lei
2017-10-03 19:31       ` Tejun Heo
2017-10-03 18:40   ` Bart Van Assche
2017-10-03 18:40     ` Bart Van Assche
2017-10-03 19:24     ` Ming Lei
2017-10-03 14:04 ` [PATCH V8 6/8] blk-mq: return if queue is frozen via current blk_freeze_queue_start Ming Lei
2017-10-03 14:04 ` [PATCH V8 7/8] block: support PREEMPT_ONLY Ming Lei
2017-10-03 14:04 ` [PATCH V8 8/8] SCSI: set block queue at preempt only when SCSI device is put into quiesce Ming Lei
2017-10-03 18:27 ` [PATCH V8 0/8] block/scsi: safe SCSI quiescing Oleksandr Natalenko
2017-10-03 18:27   ` Oleksandr Natalenko
2017-11-07 12:32 ` Oleksandr Natalenko
2017-11-07 13:17   ` Ming Lei

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.