From: Jeff Layton <jlayton@redhat.com>
To: "Yan, Zheng" <zyan@redhat.com>, ceph-devel@vger.kernel.org
Cc: stable@vger.kernel.org
Subject: Re: [PATCH] ceph: decease session->s_trim_caps only after caps get trimmed
Date: Thu, 30 Nov 2017 07:00:04 -0500 [thread overview]
Message-ID: <1512043204.4132.1.camel@redhat.com> (raw)
In-Reply-To: <20171130075358.7803-1-zyan@redhat.com>
On Thu, 2017-11-30 at 15:53 +0800, Yan, Zheng wrote:
> d_prune_aliases() does not prune dentry that has non-zero reference
> count. If we want trim_caps() to trim 'N' caps, the first 'N' inodes
> in session->s_caps are all directories with child dentry, trim_caps()
> can fail to trim anything.
>
> Cc: stable@vger.kernel.org
> Signed-off-by: "Yan, Zheng" <zyan@redhat.com>
> ---
> fs/ceph/mds_client.c | 8 ++++++--
> 1 file changed, 6 insertions(+), 2 deletions(-)
>
> diff --git a/fs/ceph/mds_client.c b/fs/ceph/mds_client.c
> index 80339e278ad8..da181acd4a61 100644
> --- a/fs/ceph/mds_client.c
> +++ b/fs/ceph/mds_client.c
> @@ -1490,16 +1490,20 @@ static int trim_caps_cb(struct inode *inode, struct ceph_cap *cap, void *arg)
> if ((used | wanted) & ~oissued & mine)
> goto out; /* we need these caps */
>
> - session->s_trim_caps--;
> if (oissued) {
> /* we aren't the only cap.. just remove us */
> __ceph_remove_cap(cap, true);
> + session->s_trim_caps--;
> } else {
> + int refs;
> /* try dropping referring dentries */
> spin_unlock(&ci->i_ceph_lock);
> d_prune_aliases(inode);
> + refs = atomic_read(&inode->i_count);
> + if (refs == 1)
> + session->s_trim_caps--;
> dout("trim_caps_cb %p cap %p pruned, count now %d\n",
> - inode, cap, atomic_read(&inode->i_count));
> + inode, cap, refs);
> return 0;
> }
>
Reviewed-by: Jeff Layton <jlayton@redhat.com>
prev parent reply other threads:[~2017-11-30 12:00 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-11-30 7:53 [PATCH] ceph: decease session->s_trim_caps only after caps get trimmed Yan, Zheng
2017-11-30 7:55 ` Yan, Zheng
2017-11-30 12:00 ` Jeff Layton [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=1512043204.4132.1.camel@redhat.com \
--to=jlayton@redhat.com \
--cc=ceph-devel@vger.kernel.org \
--cc=stable@vger.kernel.org \
--cc=zyan@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).