From: Jeff Layton <jlayton@kernel.org>
To: Xiubo Li <xiubli@redhat.com>, Ilya Dryomov <idryomov@gmail.com>
Cc: "Yan, Zheng" <zyan@redhat.com>,
Patrick Donnelly <pdonnell@redhat.com>,
Ceph Development <ceph-devel@vger.kernel.org>
Subject: Re: [PATCH v5 0/2] ceph: metrics for opened files, pinned caps and opened inodes
Date: Fri, 11 Sep 2020 07:49:16 -0400 [thread overview]
Message-ID: <a281843181d1c97d099a2dd88c216ca94cf8d544.camel@kernel.org> (raw)
In-Reply-To: <9a5c5d2f-d105-21c4-327e-5ad18bf49518@redhat.com>
On Fri, 2020-09-11 at 11:43 +0800, Xiubo Li wrote:
> On 2020/9/10 20:13, Jeff Layton wrote:
> > On Thu, 2020-09-10 at 08:00 +0200, Ilya Dryomov wrote:
> > > On Thu, Sep 10, 2020 at 2:59 AM Xiubo Li <xiubli@redhat.com> wrote:
> > > > On 2020/9/10 4:34, Ilya Dryomov wrote:
> > > > > On Thu, Sep 3, 2020 at 4:22 PM Xiubo Li <xiubli@redhat.com> wrote:
> > > > > > On 2020/9/3 22:18, Jeff Layton wrote:
> > > > > > > On Thu, 2020-09-03 at 09:01 -0400, xiubli@redhat.com wrote:
> > > > > > > > From: Xiubo Li <xiubli@redhat.com>
> > > > > > > >
> > > > > > > > Changed in V5:
> > > > > > > > - Remove mdsc parsing helpers except the ceph_sb_to_mdsc()
> > > > > > > > - Remove the is_opened member.
> > > > > > > >
> > > > > > > > Changed in V4:
> > > > > > > > - A small fix about the total_inodes.
> > > > > > > >
> > > > > > > > Changed in V3:
> > > > > > > > - Resend for V2 just forgot one patch, which is adding some helpers
> > > > > > > > support to simplify the code.
> > > > > > > >
> > > > > > > > Changed in V2:
> > > > > > > > - Add number of inodes that have opened files.
> > > > > > > > - Remove the dir metrics and fold into files.
> > > > > > > >
> > > > > > > >
> > > > > > > >
> > > > > > > > Xiubo Li (2):
> > > > > > > > ceph: add ceph_sb_to_mdsc helper support to parse the mdsc
> > > > > > > > ceph: metrics for opened files, pinned caps and opened inodes
> > > > > > > >
> > > > > > > > fs/ceph/caps.c | 41 +++++++++++++++++++++++++++++++++++++----
> > > > > > > > fs/ceph/debugfs.c | 11 +++++++++++
> > > > > > > > fs/ceph/dir.c | 20 +++++++-------------
> > > > > > > > fs/ceph/file.c | 13 ++++++-------
> > > > > > > > fs/ceph/inode.c | 11 ++++++++---
> > > > > > > > fs/ceph/locks.c | 2 +-
> > > > > > > > fs/ceph/metric.c | 14 ++++++++++++++
> > > > > > > > fs/ceph/metric.h | 7 +++++++
> > > > > > > > fs/ceph/quota.c | 10 +++++-----
> > > > > > > > fs/ceph/snap.c | 2 +-
> > > > > > > > fs/ceph/super.h | 6 ++++++
> > > > > > > > 11 files changed, 103 insertions(+), 34 deletions(-)
> > > > > > > >
> > > > > > > Looks good. I went ahead and merge this into testing.
> > > > > > >
> > > > > > > Small merge conflict in quota.c, which I guess is probably due to not
> > > > > > > basing this on testing branch. I also dropped what looks like an
> > > > > > > unrelated hunk in the second patch.
> > > > > > >
> > > > > > > In the future, if you can be sure that patches you post apply cleanly to
> > > > > > > testing branch then that would make things easier.
> > > > > > Okay, will do it.
> > > > > Hi Xiubo,
> > > > >
> > > > > There is a problem with lifetimes here. mdsc isn't guaranteed to exist
> > > > > when ->free_inode() is called. This can lead to crashes on a NULL mdsc
> > > > > in ceph_free_inode() in case of e.g. "umount -f". I know it was Jeff's
> > > > > suggestion to move the decrement of total_inodes into ceph_free_inode(),
> > > > > but it doesn't look like it can be easily deferred past ->evict_inode().
> > > > Okay, I will take a look.
> > > Given that it's just a counter which we don't care about if the
> > > mount is going away, some form of "if (mdsc)" check might do, but
> > > need to make sure that it covers possible races, if any.
> > >
> > Good catch, Ilya.
> >
> > What may be best is to move the increment out of ceph_alloc_inode and
> > instead put it in ceph_set_ino_cb. Then the decrement can go back into
> > ceph_evict_inode.
>
> Hi Jeff, Ilya
>
> Checked the code, it seems in the ceph_evict_inode() we will also hit
> the same issue .
>
> With the '-f' options when umounting, it will skip the inodes whose
> i_count ref > 0. And then free the fsc/mdsc in ceph. And later the
> iput_final() will call the ceph_evict_inode() and then ceph_free_inode().
>
> Could we just check if !!(sb->s_flags & SB_ACTIVE) is false will we skip
> the counting ?
>
Note that umount -f (MNT_FORCE) just means that ceph_umount_begin is
called before unmounting.
If what you're saying it true, then we have bigger problems.
ceph_evict_inode does this today when ci->i_snap_realm is set:
struct ceph_mds_client *mdsc = ceph_inode_to_client(inode)->mdsc;
...and then goes on to use that mdsc pointer.
I wonder if we ought to be moving move some of the operations in
ceph_kill_sb into ceph_put_super... particularly the call to
destroy_fs_client()?
--
Jeff Layton <jlayton@kernel.org>
next prev parent reply other threads:[~2020-09-11 11:50 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-09-03 13:01 [PATCH v5 0/2] ceph: metrics for opened files, pinned caps and opened inodes xiubli
2020-09-03 13:01 ` [PATCH v5 1/2] ceph: add ceph_sb_to_mdsc helper support to parse the mdsc xiubli
2020-09-03 13:01 ` [PATCH v5 2/2] ceph: metrics for opened files, pinned caps and opened inodes xiubli
2020-09-03 14:16 ` Jeff Layton
2020-09-03 14:20 ` Xiubo Li
2020-09-03 14:18 ` [PATCH v5 0/2] " Jeff Layton
2020-09-03 14:22 ` Xiubo Li
2020-09-09 20:34 ` Ilya Dryomov
2020-09-10 0:59 ` Xiubo Li
2020-09-10 6:00 ` Ilya Dryomov
2020-09-10 12:13 ` Jeff Layton
2020-09-11 3:43 ` Xiubo Li
2020-09-11 11:49 ` Jeff Layton [this message]
2020-09-11 19:46 ` Jeff Layton
2020-09-12 4:04 ` Xiubo Li
2020-09-12 10:18 ` Jeff Layton
2020-09-13 10:40 ` Ilya Dryomov
2020-09-13 12:45 ` Jeff Layton
2020-09-12 3:54 ` 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=a281843181d1c97d099a2dd88c216ca94cf8d544.camel@kernel.org \
--to=jlayton@kernel.org \
--cc=ceph-devel@vger.kernel.org \
--cc=idryomov@gmail.com \
--cc=pdonnell@redhat.com \
--cc=xiubli@redhat.com \
--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).