From: Guoqing Jiang <gqjiang@suse.com>
To: Shaohua Li <shli@fb.com>, linux-raid@vger.kernel.org
Cc: Goldwyn Rodrigues <rgoldwyn@suse.com>, NeilBrown <neilb@suse.com>
Subject: Re: [PATCH 1/2] md-cluster: fix missing memory free
Date: Mon, 25 Jan 2016 09:33:54 +0800 [thread overview]
Message-ID: <56A57B82.2050003@suse.com> (raw)
In-Reply-To: <0bc7fe7dece2c5aa4f8ed7194df27b02e0ae3142.1453509823.git.shli@fb.com>
On 01/23/2016 08:45 AM, Shaohua Li wrote:
> There are several places we allocate dlm_lock_resource, but not free it.
Culd you also add below change? Thanks.
diff --git a/drivers/md/md-cluster.c b/drivers/md/md-cluster.c
index 0ded8e9..6c756e2 100644
--- a/drivers/md/md-cluster.c
+++ b/drivers/md/md-cluster.c
@@ -858,6 +858,7 @@ static int leave(struct mddev *mddev)
lockres_free(cinfo->token_lockres);
lockres_free(cinfo->ack_lockres);
lockres_free(cinfo->no_new_dev_lockres);
+ lockres_free(cinfo->resync_lockres);
lockres_free(cinfo->bitmap_lockres);
unlock_all_bitmaps(mddev);
dlm_release_lockspace(cinfo->lockspace, 2);
Guoqing
>
> Cc: Goldwyn Rodrigues <rgoldwyn@suse.com>
> Cc: Guoqing Jiang <gqjiang@suse.com>
> Cc: NeilBrown <neilb@suse.com>
> Signed-off-by: Shaohua Li <shli@fb.com>
> ---
> drivers/md/md-cluster.c | 5 ++++-
> 1 file changed, 4 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/md/md-cluster.c b/drivers/md/md-cluster.c
> index 0ded8e9..662369c 100644
> --- a/drivers/md/md-cluster.c
> +++ b/drivers/md/md-cluster.c
> @@ -293,6 +293,7 @@ static void recover_bitmaps(struct md_thread *thread)
> dlm_unlock:
> dlm_unlock_sync(bm_lockres);
> clear_bit:
> + lockres_free(bm_lockres);
> clear_bit(slot, &cinfo->recovery_map);
> }
> }
> @@ -682,8 +683,10 @@ static int gather_all_resync_info(struct mddev *mddev, int total_slots)
> bm_lockres = lockres_init(mddev, str, NULL, 1);
> if (!bm_lockres)
> return -ENOMEM;
> - if (i == (cinfo->slot_number - 1))
> + if (i == (cinfo->slot_number - 1)) {
> + lockres_free(bm_lockres);
> continue;
> + }
>
> bm_lockres->flags |= DLM_LKF_NOQUEUE;
> ret = dlm_lock_sync(bm_lockres, DLM_LOCK_PW);
prev parent reply other threads:[~2016-01-25 1:33 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-01-23 0:45 [PATCH 1/2] md-cluster: fix missing memory free Shaohua Li
2016-01-23 0:45 ` [PATCH 2/2] md-cluster: delete useless code Shaohua Li
2016-01-25 1:40 ` Guoqing Jiang
2016-01-25 1:33 ` Guoqing Jiang [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=56A57B82.2050003@suse.com \
--to=gqjiang@suse.com \
--cc=linux-raid@vger.kernel.org \
--cc=neilb@suse.com \
--cc=rgoldwyn@suse.com \
--cc=shli@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).