All of lore.kernel.org
 help / color / mirror / Atom feed
From: Al Viro <viro@ZenIV.linux.org.uk>
To: "Yan, Zheng" <ukernel@gmail.com>
Cc: Sage Weil <sage@inktank.com>,
	ceph-devel <ceph-devel@vger.kernel.org>,
	linux-fsdevel@vger.kernel.org
Subject: Re: [RFC] several ceph dentry leaks
Date: Mon, 2 Feb 2015 04:41:35 +0000	[thread overview]
Message-ID: <20150202044135.GR29656@ZenIV.linux.org.uk> (raw)
In-Reply-To: <CAAM7YAm_ZRtEG3iOGsgY8wYNXYBJhKMQLk=3knqmtef4N8nKKA@mail.gmail.com>

On Mon, Feb 02, 2015 at 11:23:58AM +0800, Yan, Zheng wrote:
> > we should _never_ create multiple dentries pointing to directory inode, so
> > d_instantiate() in there isn't mitigating anything - it's actively breaking
> > things as far as the rest of the kernel is concerned...  What are you
> > trying to do there?
> 
> ceph_handle_notrace_create() is for case: Ceph Metadata server restarted,
> client re-sent a request. Ceph MDS found the request has already completed,
> so it sent a traceless reply to client. (traceless reply contains no information
> for the dentry and the newly created inode). It's hard to handle this case
> elegantly, because MDS may have done other operation, which moved the
> newly created file/directory to other place.
> 
> For multiple dentries pointing to directory inode, maybe we can return an error
> (-ENOENT or -ESTALE).

IDGI...  Suppose we got non-NULL from ceph_lookup() there.  So we'd sent either
CEPH_MDS_OP_LOOKUP or CEPH_MDS_OP_LOOKUPSNAP and got ->r_dentry changed
(presumably in ceph_fill_trace(), after it got the sucker from splice_dentry(),
i.e. ultimately d_splice_alias()).  Right?  Now, we have acquired a reference
to it (in ceph_finish_lookup()).  So far, so good; for one thing, we definitely
do *NOT* want to forget about that reference.  For another, we've got
a good and valid dentry; so why are we playing with the originally passed
one?  Just unhash the original and be done with that...

Looking at the code downstream from the calls of ceph_handle_notrace_create(),
ceph_mkdir() looks very dubious - we do ceph_init_inode_acls(dentry->d_inode,
&acls); there, after having set ->d_inode to that of a preexisting alias.
Is that really correct in the case when such an alias used to exist?

  reply	other threads:[~2015-02-02  4:41 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-02-02  0:31 [RFC] several ceph dentry leaks Al Viro
2015-02-02  3:23 ` Yan, Zheng
2015-02-02  4:41   ` Al Viro [this message]
2015-02-02  6:19     ` Yan, Zheng

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=20150202044135.GR29656@ZenIV.linux.org.uk \
    --to=viro@zeniv.linux.org.uk \
    --cc=ceph-devel@vger.kernel.org \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=sage@inktank.com \
    --cc=ukernel@gmail.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.