From: Yufen Yu <yuyufen@huawei.com>
To: <jbacik@fb.com>, <tj@kernel.org>, <axboe@kernel.dk>
Cc: <linux-block@vger.kernel.org>
Subject: Re: [PATCH] blkcg: fix memleak for iolatency
Date: Tue, 11 Aug 2020 10:00:30 +0800 [thread overview]
Message-ID: <b296f6f2-3167-c562-fd42-bce6d9b609f4@huawei.com> (raw)
In-Reply-To: <20200811015744.1823282-1-yuyufen@huawei.com>
Ignore this. There is an obvious mistake. I will resend v2.
Thanks,
Yufen
On 2020/8/11 9:57, Yufen Yu wrote:
> Normally, blkcg_iolatency_exit() will free related memory in iolatency
> when cleanup queue. But if blk_throtl_init() return error and queue init
> fail, blkcg_iolatency_exit() will not do that for us. Then it cause
> memory leak.
>
> Fixes: d70675121546 ("block: introduce blk-iolatency io controller")
> Signed-off-by: Yufen Yu <yuyufen@huawei.com>
> ---
> block/blk-cgroup.c | 10 ++++++----
> 1 file changed, 6 insertions(+), 4 deletions(-)
>
> diff --git a/block/blk-cgroup.c b/block/blk-cgroup.c
> index 619a79b51068..6f91b2ae0b27 100644
> --- a/block/blk-cgroup.c
> +++ b/block/blk-cgroup.c
> @@ -1152,15 +1152,17 @@ int blkcg_init_queue(struct request_queue *q)
> if (preloaded)
> radix_tree_preload_end();
>
> - ret = blk_iolatency_init(q);
> - if (ret)
> - goto err_destroy_all;
> -
> ret = blk_throtl_init(q);
> if (ret)
> goto err_destroy_all;
> return 0;
>
> + ret = blk_iolatency_init(q);
> + if (ret) {
> + blk_throtl_exit(q);
> + goto err_destroy_all;
> + }
> +
> err_destroy_all:
> blkg_destroy_all(q);
> return ret;
>
prev parent reply other threads:[~2020-08-11 2:00 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-08-11 1:57 [PATCH] blkcg: fix memleak for iolatency Yufen Yu
2020-08-11 2:00 ` Yufen Yu [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=b296f6f2-3167-c562-fd42-bce6d9b609f4@huawei.com \
--to=yuyufen@huawei.com \
--cc=axboe@kernel.dk \
--cc=jbacik@fb.com \
--cc=linux-block@vger.kernel.org \
--cc=tj@kernel.org \
/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).