diff mbox series

blk-mq: check quiesce state before queue_rqs

Message ID 20211220205412.151342-1-kbusch@kernel.org (mailing list archive)
State New, archived
Headers show
Series blk-mq: check quiesce state before queue_rqs | expand

Commit Message

Keith Busch Dec. 20, 2021, 8:54 p.m. UTC
The low level drivers don't expect to see new requests after a
successful quiesce completes. Check the queue quiesce state within the
rcu protected area prior to calling the driver's queue_rqs().

Signed-off-by: Keith Busch <kbusch@kernel.org>
---
 block/blk-mq.c | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

Comments

Keith Busch Dec. 20, 2021, 8:56 p.m. UTC | #1
On Mon, Dec 20, 2021 at 12:54:12PM -0800, Keith Busch wrote:
> +void __blk_mq_flush_plug_list(struct request_queue *q, struct blk_plug *plug)

Oops, the above needs to be static. Let me send a v2.

> +{
> +	if (blk_queue_quiesced(q))
> +		return;
> +	q->mq_ops->queue_rqs(&plug->mq_list);
> +}
kernel test robot Dec. 20, 2021, 10:59 p.m. UTC | #2
Hi Keith,

I love your patch! Perhaps something to improve:

[auto build test WARNING on axboe-block/for-next]
[also build test WARNING on next-20211220]
[cannot apply to v5.16-rc6]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]

url:    https://github.com/0day-ci/linux/commits/Keith-Busch/blk-mq-check-quiesce-state-before-queue_rqs/20211221-045504
base:   https://git.kernel.org/pub/scm/linux/kernel/git/axboe/linux-block.git for-next
config: um-i386_defconfig (https://download.01.org/0day-ci/archive/20211221/202112210618.hCiNGmq9-lkp@intel.com/config)
compiler: gcc-9 (Debian 9.3.0-22) 9.3.0
reproduce (this is a W=1 build):
        # https://github.com/0day-ci/linux/commit/8004ce63b95d4be66e4ad8655a05ee21a9a148d8
        git remote add linux-review https://github.com/0day-ci/linux
        git fetch --no-tags linux-review Keith-Busch/blk-mq-check-quiesce-state-before-queue_rqs/20211221-045504
        git checkout 8004ce63b95d4be66e4ad8655a05ee21a9a148d8
        # save the config file to linux build tree
        mkdir build_dir
        make W=1 O=build_dir ARCH=um SUBARCH=i386 SHELL=/bin/bash

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>

All warnings (new ones prefixed by >>):

>> block/blk-mq.c:2552:6: warning: no previous prototype for '__blk_mq_flush_plug_list' [-Wmissing-prototypes]
    2552 | void __blk_mq_flush_plug_list(struct request_queue *q, struct blk_plug *plug)
         |      ^~~~~~~~~~~~~~~~~~~~~~~~


vim +/__blk_mq_flush_plug_list +2552 block/blk-mq.c

  2551	
> 2552	void __blk_mq_flush_plug_list(struct request_queue *q, struct blk_plug *plug)
  2553	{
  2554		if (blk_queue_quiesced(q))
  2555			return;
  2556		q->mq_ops->queue_rqs(&plug->mq_list);
  2557	}
  2558	

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
diff mbox series

Patch

diff --git a/block/blk-mq.c b/block/blk-mq.c
index 51991232824a..c8a30017c778 100644
--- a/block/blk-mq.c
+++ b/block/blk-mq.c
@@ -2549,6 +2549,13 @@  static void blk_mq_plug_issue_direct(struct blk_plug *plug, bool from_schedule)
 		blk_mq_commit_rqs(hctx, &queued, from_schedule);
 }
 
+void __blk_mq_flush_plug_list(struct request_queue *q, struct blk_plug *plug)
+{
+	if (blk_queue_quiesced(q))
+		return;
+	q->mq_ops->queue_rqs(&plug->mq_list);
+}
+
 void blk_mq_flush_plug_list(struct blk_plug *plug, bool from_schedule)
 {
 	struct blk_mq_hw_ctx *this_hctx;
@@ -2580,7 +2587,7 @@  void blk_mq_flush_plug_list(struct blk_plug *plug, bool from_schedule)
 		if (q->mq_ops->queue_rqs &&
 		    !(rq->mq_hctx->flags & BLK_MQ_F_TAG_QUEUE_SHARED)) {
 			blk_mq_run_dispatch_ops(q,
-				q->mq_ops->queue_rqs(&plug->mq_list));
+				__blk_mq_flush_plug_list(q, plug));
 			if (rq_list_empty(plug->mq_list))
 				return;
 		}