All of lore.kernel.org
 help / color / mirror / Atom feed
From: Bart Van Assche <bvanassche@acm.org>
To: Jens Axboe <axboe@kernel.dk>
Cc: linux-block@vger.kernel.org, Christoph Hellwig <hch@lst.de>,
	Bart Van Assche <bvanassche@acm.org>,
	Christoph Hellwig <hch@infradead.org>,
	Ming Lei <ming.lei@redhat.com>, Hannes Reinecke <hare@suse.com>,
	Johannes Thumshirn <jth@kernel.org>
Subject: [PATCH v3 8/8] null_blk: Add support for init_hctx() fault injection
Date: Thu, 20 Feb 2020 19:22:43 -0800	[thread overview]
Message-ID: <20200221032243.9708-9-bvanassche@acm.org> (raw)
In-Reply-To: <20200221032243.9708-1-bvanassche@acm.org>

This makes it possible to test the error path in blk_mq_realloc_hw_ctxs()
and also several error paths in null_blk.

Cc: Christoph Hellwig <hch@infradead.org>
Cc: Ming Lei <ming.lei@redhat.com>
Cc: Hannes Reinecke <hare@suse.com>
Cc: Johannes Thumshirn <jth@kernel.org>
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
---
 drivers/block/null_blk_main.c | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/drivers/block/null_blk_main.c b/drivers/block/null_blk_main.c
index ba83fd0537ce..7fccf162b59b 100644
--- a/drivers/block/null_blk_main.c
+++ b/drivers/block/null_blk_main.c
@@ -23,6 +23,7 @@
 #ifdef CONFIG_BLK_DEV_NULL_BLK_FAULT_INJECTION
 static DECLARE_FAULT_ATTR(null_timeout_attr);
 static DECLARE_FAULT_ATTR(null_requeue_attr);
+static DECLARE_FAULT_ATTR(null_init_hctx_attr);
 #endif
 
 static inline u64 mb_per_tick(int mbps)
@@ -101,6 +102,9 @@ module_param_string(timeout, g_timeout_str, sizeof(g_timeout_str), 0444);
 
 static char g_requeue_str[80];
 module_param_string(requeue, g_requeue_str, sizeof(g_requeue_str), 0444);
+
+static char g_init_hctx_str[80];
+module_param_string(init_hctx, g_init_hctx_str, sizeof(g_init_hctx_str), 0444);
 #endif
 
 static int g_queue_mode = NULL_Q_MQ;
@@ -1451,6 +1455,11 @@ static int null_init_hctx(struct blk_mq_hw_ctx *hctx, void *driver_data,
 	struct nullb *nullb = hctx->queue->queuedata;
 	struct nullb_queue *nq;
 
+#ifdef CONFIG_BLK_DEV_NULL_BLK_FAULT_INJECTION
+	if (g_init_hctx_str[0] && should_fail(&null_init_hctx_attr, 1))
+		return -EFAULT;
+#endif
+
 	nq = &nullb->queues[hctx_idx];
 	hctx->driver_data = nq;
 	null_init_queue(nullb, nq);
@@ -1685,6 +1694,8 @@ static bool null_setup_fault(void)
 		return false;
 	if (!__null_setup_fault(&null_requeue_attr, g_requeue_str))
 		return false;
+	if (!__null_setup_fault(&null_init_hctx_attr, g_init_hctx_str))
+		return false;
 #endif
 	return true;
 }

      parent reply	other threads:[~2020-02-21  3:23 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-02-21  3:22 [PATCH v3 0/8] Improve changing the number of hardware queues Bart Van Assche
2020-02-21  3:22 ` [PATCH v3 1/8] blk-mq: Fix a comment in include/linux/blk-mq.h Bart Van Assche
2020-02-24 10:58   ` Chaitanya Kulkarni
2020-02-21  3:22 ` [PATCH v3 2/8] blk-mq: Keep set->nr_hw_queues and set->map[].nr_queues in sync Bart Van Assche
2020-02-24 11:00   ` Chaitanya Kulkarni
2020-02-25  0:47   ` Ming Lei
2020-03-06  2:46     ` Ming Lei
2020-03-06 10:04       ` Ming Lei
2020-02-21  3:22 ` [PATCH v3 3/8] blk-mq: Fix a recently introduced regression in blk_mq_realloc_hw_ctxs() Bart Van Assche
2020-02-21  3:22 ` [PATCH v3 4/8] null_blk: Suppress an UBSAN complaint triggered when setting 'memory_backed' Bart Van Assche
2020-02-24 11:28   ` Chaitanya Kulkarni
2020-02-24 15:20     ` Bart Van Assche
2020-02-21  3:22 ` [PATCH v3 5/8] null_blk: Fix changing the number of hardware queues Bart Van Assche
2020-02-21  3:22 ` [PATCH v3 6/8] null_blk: Fix the null_add_dev() error path Bart Van Assche
2020-02-24 11:30   ` Chaitanya Kulkarni
2020-02-21  3:22 ` [PATCH v3 7/8] null_blk: Handle null_add_dev() failures properly Bart Van Assche
2020-02-24 11:31   ` Chaitanya Kulkarni
2020-02-21  3:22 ` Bart Van Assche [this message]

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=20200221032243.9708-9-bvanassche@acm.org \
    --to=bvanassche@acm.org \
    --cc=axboe@kernel.dk \
    --cc=hare@suse.com \
    --cc=hch@infradead.org \
    --cc=hch@lst.de \
    --cc=jth@kernel.org \
    --cc=linux-block@vger.kernel.org \
    --cc=ming.lei@redhat.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 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.