summaryrefslogtreecommitdiffstats
path: root/fs/dcache.c
diff options
context:
space:
mode:
authorAl Viro <viro@zeniv.linux.org.uk>2016-04-14 19:40:56 -0400
committerAl Viro <viro@zeniv.linux.org.uk>2016-05-02 19:47:26 -0400
commit0568d705b0087751f0c085c0a665aa3e954c810d (patch)
treebe004775897eae9809cfb341135aab59c7f949c5 /fs/dcache.c
parent1936386ea96591c27ae4b70caef9591c41e6290f (diff)
downloadlinux-0568d705b0087751f0c085c0a665aa3e954c810d.tar.gz
linux-0568d705b0087751f0c085c0a665aa3e954c810d.tar.bz2
linux-0568d705b0087751f0c085c0a665aa3e954c810d.zip
__d_add(): don't drop/regain ->d_lock
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'fs/dcache.c')
-rw-r--r--fs/dcache.c14
1 files changed, 11 insertions, 3 deletions
diff --git a/fs/dcache.c b/fs/dcache.c
index 4962a7b4384e..20394fb6f967 100644
--- a/fs/dcache.c
+++ b/fs/dcache.c
@@ -2366,11 +2366,19 @@ EXPORT_SYMBOL(d_rehash);
static inline void __d_add(struct dentry *dentry, struct inode *inode)
{
+ spin_lock(&dentry->d_lock);
if (inode) {
- __d_instantiate(dentry, inode);
+ unsigned add_flags = d_flags_for_inode(inode);
+ 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);
+ __fsnotify_d_instantiate(dentry);
+ }
+ _d_rehash(dentry);
+ spin_unlock(&dentry->d_lock);
+ if (inode)
spin_unlock(&inode->i_lock);
- }
- d_rehash(dentry);
}
/**