summaryrefslogtreecommitdiff
path: root/fs/dcache.c
diff options
context:
space:
mode:
authorAl Viro <viro@zeniv.linux.org.uk>2016-03-09 18:05:42 -0500
committerAl Viro <viro@zeniv.linux.org.uk>2016-03-14 00:17:32 -0400
commitde689f5e366373682e95059e9b89d981187e4544 (patch)
treeb9116bb43a5699087b7e3c06602881a90c94a9a1 /fs/dcache.c
parent27f203f655a2e1dab66598a5b19afb637c587f0b (diff)
downloadlwn-de689f5e366373682e95059e9b89d981187e4544.tar.gz
lwn-de689f5e366373682e95059e9b89d981187e4544.zip
don't bother with __d_instantiate(dentry, NULL)
it's a no-op - bumping ->d_seq is pointless there. Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'fs/dcache.c')
-rw-r--r--fs/dcache.c17
1 files changed, 7 insertions, 10 deletions
diff --git a/fs/dcache.c b/fs/dcache.c
index 244fd2487fe9..57da4127ea04 100644
--- a/fs/dcache.c
+++ b/fs/dcache.c
@@ -1745,13 +1745,11 @@ static void __d_instantiate(struct dentry *dentry, struct inode *inode)
unsigned add_flags = d_flags_for_inode(inode);
spin_lock(&dentry->d_lock);
- if (inode)
- hlist_add_head(&dentry->d_u.d_alias, &inode->i_dentry);
+ hlist_add_head(&dentry->d_u.d_alias, &inode->i_dentry);
raw_write_seqcount_begin(&dentry->d_seq);
__d_set_inode_and_type(dentry, inode, add_flags);
raw_write_seqcount_end(&dentry->d_seq);
- if (inode)
- __fsnotify_d_instantiate(dentry);
+ __fsnotify_d_instantiate(dentry);
spin_unlock(&dentry->d_lock);
}
@@ -1773,11 +1771,11 @@ static void __d_instantiate(struct dentry *dentry, struct inode *inode)
void d_instantiate(struct dentry *entry, struct inode * inode)
{
BUG_ON(!hlist_unhashed(&entry->d_u.d_alias));
- if (inode)
+ if (inode) {
spin_lock(&inode->i_lock);
- __d_instantiate(entry, inode);
- if (inode)
+ __d_instantiate(entry, inode);
spin_unlock(&inode->i_lock);
+ }
security_d_instantiate(entry, inode);
}
EXPORT_SYMBOL(d_instantiate);
@@ -2764,10 +2762,9 @@ struct dentry *d_splice_alias(struct inode *inode, struct dentry *dentry)
BUG_ON(!d_unhashed(dentry));
- if (!inode) {
- __d_instantiate(dentry, NULL);
+ if (!inode)
goto out;
- }
+
spin_lock(&inode->i_lock);
if (S_ISDIR(inode->i_mode)) {
struct dentry *new = __d_find_any_alias(inode);