From: Al Viro <viro@ZenIV.linux.org.uk>
To: Christoph Hellwig <hch@infradead.org>
Cc: linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org
Subject: WTF is d_add_ci() doing with negative dentries?
Date: Sun, 12 Oct 2014 23:18:17 +0100 [thread overview]
Message-ID: <20141012221817.GU7996@ZenIV.linux.org.uk> (raw)
AFAICS, if d_add_ci() ever finds a negative hashed dentry for
exact name, it's already buggered. Because right *before* that
d_add_ci() lookup for exact name would've turned valid negative.
IOW, the whole thing ought to be
found = d_hash_and_lookup(dentry->d_parent, name);
if (found) {
iput(inode);
return found;
}
new = d_alloc(dentry->d_parent, name);
if (!new) {
iput(inode);
return ERR_PTR(-ENOMEM);
}
found = d_splice_alias(inode, new);
if (found) {
dput(new);
return found;
}
return new;
Moreover, it might very well be better to pass dentry->d_parent instead
of dentry... Objections?
next reply other threads:[~2014-10-12 22:18 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-10-12 22:18 Al Viro [this message]
2014-10-12 23:56 ` WTF is d_add_ci() doing with negative dentries? Anton Altaparmakov
2014-10-13 2:14 ` Al Viro
2014-10-13 9:16 ` Anton Altaparmakov
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=20141012221817.GU7996@ZenIV.linux.org.uk \
--to=viro@zeniv.linux.org.uk \
--cc=hch@infradead.org \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
/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.