linux-raid.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Guoqing Jiang <guoqing.jiang@cloud.ionos.com>
To: Zhao Heming <heming.zhao@suse.com>,
	linux-raid@vger.kernel.org, song@kernel.org
Subject: Re: [PATCH] [md-cluster] fix memory leak for bitmap
Date: Thu, 8 Oct 2020 05:36:28 +0200	[thread overview]
Message-ID: <fd2dddb4-13d1-31a3-a2ee-031a8e781634@cloud.ionos.com> (raw)
In-Reply-To: <1601185213-7464-1-git-send-email-heming.zhao@suse.com>



On 9/27/20 07:40, Zhao Heming wrote:
> current code doesn't free temporary bitmap memory.
>
> Signed-off-by: Zhao Heming <heming.zhao@suse.com>
> ---
>   drivers/md/md-bitmap.c  | 1 +
>   drivers/md/md-cluster.c | 1 +
>   2 files changed, 2 insertions(+)
>
> diff --git a/drivers/md/md-bitmap.c b/drivers/md/md-bitmap.c
> index b10c519..593fe15 100644
> --- a/drivers/md/md-bitmap.c
> +++ b/drivers/md/md-bitmap.c
> @@ -2012,6 +2012,7 @@ int md_bitmap_copy_from_slot(struct mddev *mddev, int slot,
>   	md_bitmap_unplug(mddev->bitmap);
>   	*low = lo;
>   	*high = hi;
> +	md_bitmap_free(bitmap);
>   
>   	return rv;
>   }
> diff --git a/drivers/md/md-cluster.c b/drivers/md/md-cluster.c
> index d50737e..afbbc55 100644
> --- a/drivers/md/md-cluster.c
> +++ b/drivers/md/md-cluster.c
> @@ -1166,6 +1166,7 @@ static int resize_bitmaps(struct mddev *mddev, sector_t newsize, sector_t oldsiz
>   			 * can't resize bitmap
>   			 */
>   			goto out;
> +		md_bitmap_free(bitmap);
>   	}
>   
>   	return 0;

I'd prefer add a comment for get_bitmap_from_slot to mention it's caller 
need to
free bitmap.

Thanks,
Guoqing

  reply	other threads:[~2020-10-08  3:36 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-09-27  5:40 [PATCH] [md-cluster] fix memory leak for bitmap Zhao Heming
2020-10-08  3:36 ` Guoqing Jiang [this message]
2020-10-08  6:56   ` Song Liu
2020-10-08 10:35     ` heming.zhao

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=fd2dddb4-13d1-31a3-a2ee-031a8e781634@cloud.ionos.com \
    --to=guoqing.jiang@cloud.ionos.com \
    --cc=heming.zhao@suse.com \
    --cc=linux-raid@vger.kernel.org \
    --cc=song@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).