Commit d97079e9 authored by Luis Henriques (SUSE)'s avatar Luis Henriques (SUSE) Committed by Ilya Dryomov

ceph: fix a memory leak on cap_auths in MDS client

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: 1d17de95 ("ceph: save cap_auths in MDS client when session is opened")
Signed-off-by: default avatarLuis Henriques (SUSE) <luis.henriques@linux.dev>
Reviewed-by: default avatarXiubo Li <xiubli@redhat.com>
Signed-off-by: default avatarIlya Dryomov <idryomov@gmail.com>
parent adc52461
...@@ -6016,6 +6016,18 @@ static void ceph_mdsc_stop(struct ceph_mds_client *mdsc) ...@@ -6016,6 +6016,18 @@ static void ceph_mdsc_stop(struct ceph_mds_client *mdsc)
ceph_mdsmap_destroy(mdsc->mdsmap); ceph_mdsmap_destroy(mdsc->mdsmap);
kfree(mdsc->sessions); kfree(mdsc->sessions);
ceph_caps_finalize(mdsc); 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); ceph_pool_perm_destroy(mdsc);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment