From: Al Viro <viro@ZenIV.linux.org.uk>
To: Sage Weil <sage@inktank.com>
Cc: ceph-devel@vger.kernel.org, linux-fsdevel@vger.kernel.org
Subject: [RFC] several ceph dentry leaks
Date: Mon, 2 Feb 2015 00:31:24 +0000 [thread overview]
Message-ID: <20150202003124.GQ29656@ZenIV.linux.org.uk> (raw)
What do you expect to happen when if () is taken in
int ceph_handle_notrace_create(struct inode *dir, struct dentry *dentry)
{
struct dentry *result = ceph_lookup(dir, dentry, 0);
if (result && !IS_ERR(result)) {
If result is non-NULL, it means that we have just acquired a new reference
to preexisting dentry (in ceph_finish_lookup()); where do you expect that
reference to be dropped?
Another thing: in ceph_readdir_prepopulate()
if (!dn->d_inode) {
dn = splice_dentry(dn, in, NULL);
if (IS_ERR(dn)) {
err = PTR_ERR(dn);
dn = NULL;
goto next_item;
}
}
you leak dn if that IS_ERR() ever gets hit - d_splice_alias(d, i) does *not*
drop reference to d in any cases, so splice_dentry() leaves the sum total
of all dentry refcounts unchanged. And in case when return value is
ERR_PTR(...), this assignment results in a leak. That one is trival to
fix, but ceph_handle_notrace_create() looks very confusing - if nothing else,
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?
next reply other threads:[~2015-02-02 0:31 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-02-02 0:31 Al Viro [this message]
2015-02-02 3:23 ` [RFC] several ceph dentry leaks Yan, Zheng
2015-02-02 4:41 ` Al Viro
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=20150202003124.GQ29656@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 \
/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.