From: Ilya Dryomov <idryomov@gmail.com>
To: Xiubo Li <xiubli@redhat.com>
Cc: Jeff Layton <jlayton@kernel.org>,
Patrick Donnelly <pdonnell@redhat.com>,
Ceph Development <ceph-devel@vger.kernel.org>
Subject: Re: [PATCH] ceph: correctly release memory from capsnap
Date: Tue, 17 Aug 2021 12:46:21 +0200 [thread overview]
Message-ID: <CAOi1vP_sO19Fpt=_4J9x-m_PSjP6oNsR2X9PvXZMTeqRsr5Twg@mail.gmail.com> (raw)
In-Reply-To: <20210817075816.190025-1-xiubli@redhat.com>
On Tue, Aug 17, 2021 at 9:58 AM <xiubli@redhat.com> wrote:
>
> From: Xiubo Li <xiubli@redhat.com>
>
> When force umounting, it will try to remove all the session caps.
> If there has any capsnap is in the flushing list, the remove session
> caps callback will try to release the capsnap->flush_cap memory to
> "ceph_cap_flush_cachep" slab cache, while which is allocated from
> kmalloc-256 slab cache.
>
> URL: https://tracker.ceph.com/issues/52283
> Signed-off-by: Xiubo Li <xiubli@redhat.com>
> ---
> fs/ceph/mds_client.c | 10 +++++++++-
> 1 file changed, 9 insertions(+), 1 deletion(-)
>
> diff --git a/fs/ceph/mds_client.c b/fs/ceph/mds_client.c
> index 00b3b0a0beb8..cb517753bb17 100644
> --- a/fs/ceph/mds_client.c
> +++ b/fs/ceph/mds_client.c
> @@ -1264,10 +1264,18 @@ static int remove_session_caps_cb(struct inode *inode, struct ceph_cap *cap,
> spin_unlock(&ci->i_ceph_lock);
> while (!list_empty(&to_remove)) {
> struct ceph_cap_flush *cf;
> + struct ceph_cap_snap *capsnap;
Hi Xiubo,
Add an empty line here.
> cf = list_first_entry(&to_remove,
> struct ceph_cap_flush, i_list);
> list_del(&cf->i_list);
> - ceph_free_cap_flush(cf);
> + if (cf->caps) {
> + ceph_free_cap_flush(cf);
> + } else if (READ_ONCE(fsc->mount_state) == CEPH_MOUNT_SHUTDOWN) {
What does this condition guard against? Are there other cases of
ceph_cap_flush being embedded that need to be handled differently
on !SHUTDOWN?
Should capsnaps be on to_remove list in the first place?
This sounds like stable material to me.
Thanks,
Ilya
next prev parent reply other threads:[~2021-08-17 10:47 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-08-17 7:58 [PATCH] ceph: correctly release memory from capsnap xiubli
2021-08-17 10:46 ` Ilya Dryomov [this message]
2021-08-17 12:13 ` Xiubo Li
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='CAOi1vP_sO19Fpt=_4J9x-m_PSjP6oNsR2X9PvXZMTeqRsr5Twg@mail.gmail.com' \
--to=idryomov@gmail.com \
--cc=ceph-devel@vger.kernel.org \
--cc=jlayton@kernel.org \
--cc=pdonnell@redhat.com \
--cc=xiubli@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;
as well as URLs for NNTP newsgroup(s).