From: Yu Kuai <yukuai1@huaweicloud.com>
To: Jinlong Chen <chenjinlong2016@outlook.com>, axboe@kernel.dk
Cc: linux-block@vger.kernel.org, linux-kernel@vger.kernel.org,
"yukuai (C)" <yukuai3@huawei.com>
Subject: Re: [PATCH] block: put the reference of the io scheduler module after switching back
Date: Tue, 11 Oct 2022 20:54:13 +0800 [thread overview]
Message-ID: <a0d0c50e-061b-ce4e-0341-35156dde00c7@huaweicloud.com> (raw)
In-Reply-To: <OS0P286MB0338069A20BA87C2C9B2F2E0BE239@OS0P286MB0338.JPNP286.PROD.OUTLOOK.COM>
Hi!
在 2022/10/11 18:21, Jinlong Chen 写道:
> We got a reference of the io scheduler module in
> blk_mq_elv_switch_none to prevent the module from
> being removed. We need to put that reference back
> once we are done.
However, if blk_mq_elv_switch_none() failed due to OOM, and module
reference is not acquired, blk_mq_elv_switch_back() will still be
called. This seems not to be the right fix.
Thanks,
Kuai
>
> Signed-off-by: Jinlong Chen <chenjinlong2016@outlook.com>
> ---
> block/blk-mq.c | 7 +++++++
> 1 file changed, 7 insertions(+)
>
> diff --git a/block/blk-mq.c b/block/blk-mq.c
> index 8070b6c10e8d..8dfe3bf3e599 100644
> --- a/block/blk-mq.c
> +++ b/block/blk-mq.c
> @@ -4595,6 +4595,13 @@ static void blk_mq_elv_switch_back(struct list_head *head,
>
> mutex_lock(&q->sysfs_lock);
> elevator_switch(q, t);
> + /**
> + * We got a reference of the io scheduler module in
> + * blk_mq_elv_switch_none to prevent the module from
> + * being removed. We need to put that reference back
> + * once we are done.
> + */
> + module_put(t->elevator_owner);
> mutex_unlock(&q->sysfs_lock);
> }
>
>
next prev parent reply other threads:[~2022-10-11 12:54 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-10-11 10:21 Jinlong Chen
2022-10-11 12:54 ` Yu Kuai [this message]
2022-10-11 12:59 ` Yu Kuai
2022-10-11 13:23 ` Jinlong Chen
2022-10-12 0:54 ` Jinlong Chen
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=a0d0c50e-061b-ce4e-0341-35156dde00c7@huaweicloud.com \
--to=yukuai1@huaweicloud.com \
--cc=axboe@kernel.dk \
--cc=chenjinlong2016@outlook.com \
--cc=linux-block@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=yukuai3@huawei.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
all inboxes | Powered by JetHome®