From: Xiubo Li <xiubli@redhat.com>
To: "Luis Henriques (SUSE)" <luis.henriques@linux.dev>,
Ilya Dryomov <idryomov@gmail.com>,
Milind Changire <mchangir@redhat.com>
Cc: ceph-devel@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2] ceph: fix memory in MDS client cap_auths
Date: Mon, 19 Aug 2024 18:33:20 +0800 [thread overview]
Message-ID: <9385a27a-da34-4bb3-96a4-9e54f5273d0c@redhat.com> (raw)
In-Reply-To: <20240819095217.6415-1-luis.henriques@linux.dev>
On 8/19/24 17:52, Luis Henriques (SUSE) wrote:
> The cap_auths that are allocated during an MDS session opening are never
> released, causing a memory leak detected by kmemleak. Fix this by freeing
> the memory allocated when shutting down the mds client.
>
> Fixes: 1d17de9534cb ("ceph: save cap_auths in MDS client when session is opened")
> Signed-off-by: Luis Henriques (SUSE) <luis.henriques@linux.dev>
> ---
> Changes since v1:
> * dropped mdsc->mutex locking as we don't need it at this point
>
> fs/ceph/mds_client.c | 12 ++++++++++++
> 1 file changed, 12 insertions(+)
>
> diff --git a/fs/ceph/mds_client.c b/fs/ceph/mds_client.c
> index 276e34ab3e2c..2e4b3ee7446c 100644
> --- a/fs/ceph/mds_client.c
> +++ b/fs/ceph/mds_client.c
> @@ -6015,6 +6015,18 @@ static void ceph_mdsc_stop(struct ceph_mds_client *mdsc)
> ceph_mdsmap_destroy(mdsc->mdsmap);
> kfree(mdsc->sessions);
> ceph_caps_finalize(mdsc);
> +
> + if (mdsc->s_cap_auths) {
> + int i;
> +
> + for (i = 0; i < mdsc->s_cap_auths_num; i++) {
> + kfree(mdsc->s_cap_auths[i].match.gids);
> + kfree(mdsc->s_cap_auths[i].match.path);
> + kfree(mdsc->s_cap_auths[i].match.fs_name);
> + }
> + kfree(mdsc->s_cap_auths);
> + }
> +
> ceph_pool_perm_destroy(mdsc);
> }
>
LGTM.
Reviewed-by: Xiubo Li <xiubli@redhat.com>
Will apply to the testing branch and run the tests.
Thanks Luis
- Xiubo
prev parent reply other threads:[~2024-08-19 10:33 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-08-19 9:52 Luis Henriques (SUSE)
2024-08-19 10:33 ` Xiubo Li [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=9385a27a-da34-4bb3-96a4-9e54f5273d0c@redhat.com \
--to=xiubli@redhat.com \
--cc=ceph-devel@vger.kernel.org \
--cc=idryomov@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=luis.henriques@linux.dev \
--cc=mchangir@redhat.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®