From: Bart Van Assche <bvanassche@acm.org>
To: Omar Sandoval <osandov@fb.com>
Cc: linux-block@vger.kernel.org,
Chaitanya Kulkarni <chaitanya.kulkarni@wdc.com>,
Bart Van Assche <bvanassche@acm.org>,
Ming Lei <ming.lei@redhat.com>
Subject: [PATCH blktests v2 4/4] Add a test that triggers the blk_mq_realloc_hw_ctxs() error path
Date: Sun, 15 Mar 2020 15:13:20 -0700 [thread overview]
Message-ID: <20200315221320.613-5-bvanassche@acm.org> (raw)
In-Reply-To: <20200315221320.613-1-bvanassche@acm.org>
Add a test that triggers the code touched by commit d0930bb8f46b ("blk-mq:
Fix a recently introduced regression in blk_mq_realloc_hw_ctxs()"). This
test only runs if a recently added fault injection feature is available,
namely commit 596444e75705 ("null_blk: Add support for init_hctx() fault
injection").
Cc: Ming Lei <ming.lei@redhat.com>
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
---
tests/block/030 | 42 ++++++++++++++++++++++++++++++++++++++++++
tests/block/030.out | 1 +
2 files changed, 43 insertions(+)
create mode 100755 tests/block/030
create mode 100644 tests/block/030.out
diff --git a/tests/block/030 b/tests/block/030
new file mode 100755
index 000000000000..861c85c27f09
--- /dev/null
+++ b/tests/block/030
@@ -0,0 +1,42 @@
+#!/bin/bash
+# SPDX-License-Identifier: GPL-2.0
+# Copyright 2020 Google LLC
+#
+# Trigger the blk_mq_realloc_hw_ctxs() error path.
+
+. tests/block/rc
+. common/null_blk
+
+DESCRIPTION="trigger the blk_mq_realloc_hw_ctxs() error path"
+QUICK=1
+
+requires() {
+ _have_null_blk || return $?
+ _have_module_param null_blk init_hctx || return $?
+}
+
+test() {
+ local i sq=/sys/kernel/config/nullb/nullb0/submit_queues
+
+ : "${TIMEOUT:=30}"
+ if ! _init_null_blk nr_devices=0 queue_mode=2 "init_hctx=$(nproc),100,0,0"; then
+ echo "Loading null_blk failed"
+ return 1
+ fi
+ if ! _configure_null_blk nullb0 completion_nsec=0 blocksize=512 size=16\
+ submit_queues="$(nproc)" memory_backed=1 power=1; then
+ echo "Configuring null_blk failed"
+ return 1
+ fi
+ if { echo "$(<"$sq")" >$sq; } 2>/dev/null; then
+ for ((i=0;i<100;i++)); do
+ echo 1 >$sq
+ nproc >$sq
+ done
+ else
+ echo "Skipping test because $sq cannot be modified" >>"$FULL"
+ fi
+ rmdir /sys/kernel/config/nullb/nullb0
+ _exit_null_blk
+ echo Passed
+}
diff --git a/tests/block/030.out b/tests/block/030.out
new file mode 100644
index 000000000000..863339fb8ced
--- /dev/null
+++ b/tests/block/030.out
@@ -0,0 +1 @@
+Passed
next prev parent reply other threads:[~2020-03-15 22:13 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-03-15 22:13 [PATCH blktests v2 0/4] Add a test that triggers the blk_mq_realloc_hw_ctxs() error path Bart Van Assche
2020-03-15 22:13 ` [PATCH blktests v2 1/4] Make _exit_null_blk remove all null_blk device instances Bart Van Assche
2020-03-15 23:22 ` Chaitanya Kulkarni
2020-03-16 0:25 ` Bart Van Assche
2020-03-20 20:04 ` Omar Sandoval
2020-03-15 22:13 ` [PATCH blktests v2 2/4] Use _{init,exit}_null_blk instead of open-coding these functions Bart Van Assche
2020-03-15 23:22 ` Chaitanya Kulkarni
2020-03-15 22:13 ` [PATCH blktests v2 3/4] Introduce the function _configure_null_blk() Bart Van Assche
2020-03-15 23:34 ` Chaitanya Kulkarni
2020-03-20 20:16 ` Omar Sandoval
2020-03-15 22:13 ` Bart Van Assche [this message]
2020-03-15 23:36 ` [PATCH blktests v2 4/4] Add a test that triggers the blk_mq_realloc_hw_ctxs() error path Chaitanya Kulkarni
2020-03-20 21:42 ` Omar Sandoval
2020-04-21 2:35 ` Shinichiro Kawasaki
2020-04-21 9:10 ` Shinichiro Kawasaki
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20200315221320.613-5-bvanassche@acm.org \
--to=bvanassche@acm.org \
--cc=chaitanya.kulkarni@wdc.com \
--cc=linux-block@vger.kernel.org \
--cc=ming.lei@redhat.com \
--cc=osandov@fb.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).