From: Jens Axboe <axboe@kernel.dk>
To: "Matias Bjørling" <m@bjorling.me>,
axboe@fb.com, linux-fsdevel@vger.kernel.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH] null_blk: boundary check queue_mode and irqmode
Date: Wed, 26 Nov 2014 08:21:39 -0700 [thread overview]
Message-ID: <5475F003.6070209@kernel.dk> (raw)
In-Reply-To: <1417014178-13007-1-git-send-email-m@bjorling.me>
On 11/26/2014 08:02 AM, Matias Bjørling wrote:
> When either queue_mode or irq_mode parameter is set outside its boundaries, the
> driver will not complete requests. This stalls driver initialization when
> partitions are probed. Fix by setting out of bound values to the parameters
> default.
>
> Signed-off-by: Matias Bjørling <m@bjorling.me>
> ---
> drivers/block/null_blk.c | 14 +++++++++++++-
> 1 file changed, 13 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/block/null_blk.c b/drivers/block/null_blk.c
> index caa6121..efe9f76 100644
> --- a/drivers/block/null_blk.c
> +++ b/drivers/block/null_blk.c
> @@ -506,7 +506,7 @@ static int null_add_dev(void)
> rv = init_driver_queues(nullb);
> if (rv)
> goto out_cleanup_blk_queue;
> - } else {
> + } else if (queue_mode == NULL_Q_RQ) {
> nullb->q = blk_init_queue_node(null_request_fn, &nullb->lock, home_node);
> if (!nullb->q) {
> rv = -ENOMEM;
> @@ -574,6 +574,18 @@ static int __init null_init(void)
> bs = PAGE_SIZE;
> }
>
> + if (queue_mode < 0 || queue_mode > NULL_Q_MQ) {
> + pr_warn("null_blk: invalid queue mode\n");
> + pr_warn("null_blk: defaults queue mode to multiqueue\n");
> + queue_mode = NULL_Q_MQ;
> + }
> +
> + if (irqmode < 0 || irqmode > NULL_IRQ_TIMER) {
> + pr_warn("null_blk: invalid irq mode\n");
> + pr_warn("null_blk: defauls irq mode to softirq\n");
> + irqmode = NULL_IRQ_SOFTIRQ;
> + }
Lets fix these by using module_param_cb() instead to reject invalid
values upfront.
--
Jens Axboe
--
To unsubscribe from this list: send the line "unsubscribe linux-fsdevel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
WARNING: multiple messages have this Message-ID (diff)
From: Jens Axboe <axboe@kernel.dk>
To: "Matias Bjørling" <m@bjorling.me>,
axboe@fb.com, linux-fsdevel@vger.kernel.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH] null_blk: boundary check queue_mode and irqmode
Date: Wed, 26 Nov 2014 08:21:39 -0700 [thread overview]
Message-ID: <5475F003.6070209@kernel.dk> (raw)
In-Reply-To: <1417014178-13007-1-git-send-email-m@bjorling.me>
On 11/26/2014 08:02 AM, Matias Bjørling wrote:
> When either queue_mode or irq_mode parameter is set outside its boundaries, the
> driver will not complete requests. This stalls driver initialization when
> partitions are probed. Fix by setting out of bound values to the parameters
> default.
>
> Signed-off-by: Matias Bjørling <m@bjorling.me>
> ---
> drivers/block/null_blk.c | 14 +++++++++++++-
> 1 file changed, 13 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/block/null_blk.c b/drivers/block/null_blk.c
> index caa6121..efe9f76 100644
> --- a/drivers/block/null_blk.c
> +++ b/drivers/block/null_blk.c
> @@ -506,7 +506,7 @@ static int null_add_dev(void)
> rv = init_driver_queues(nullb);
> if (rv)
> goto out_cleanup_blk_queue;
> - } else {
> + } else if (queue_mode == NULL_Q_RQ) {
> nullb->q = blk_init_queue_node(null_request_fn, &nullb->lock, home_node);
> if (!nullb->q) {
> rv = -ENOMEM;
> @@ -574,6 +574,18 @@ static int __init null_init(void)
> bs = PAGE_SIZE;
> }
>
> + if (queue_mode < 0 || queue_mode > NULL_Q_MQ) {
> + pr_warn("null_blk: invalid queue mode\n");
> + pr_warn("null_blk: defaults queue mode to multiqueue\n");
> + queue_mode = NULL_Q_MQ;
> + }
> +
> + if (irqmode < 0 || irqmode > NULL_IRQ_TIMER) {
> + pr_warn("null_blk: invalid irq mode\n");
> + pr_warn("null_blk: defauls irq mode to softirq\n");
> + irqmode = NULL_IRQ_SOFTIRQ;
> + }
Lets fix these by using module_param_cb() instead to reject invalid
values upfront.
--
Jens Axboe
next prev parent reply other threads:[~2014-11-26 15:21 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-11-26 15:02 [PATCH] null_blk: boundary check queue_mode and irqmode Matias Bjørling
2014-11-26 15:21 ` Jens Axboe [this message]
2014-11-26 15:21 ` Jens Axboe
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=5475F003.6070209@kernel.dk \
--to=axboe@kernel.dk \
--cc=axboe@fb.com \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=m@bjorling.me \
/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.