[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <1460768127-31822-10-git-send-email-viro@ZenIV.linux.org.uk>
Date: Sat, 16 Apr 2016 01:55:22 +0100
From: Al Viro <viro@...IV.linux.org.uk>
To: Linus Torvalds <torvalds@...ux-foundation.org>
Cc: linux-kernel@...r.kernel.org, linux-fsdevel@...r.kernel.org
Subject: [PATCH 10/15] __d_add(): don't drop/regain ->d_lock
From: Al Viro <viro@...iv.linux.org.uk>
Signed-off-by: Al Viro <viro@...iv.linux.org.uk>
---
fs/dcache.c | 14 +++++++++++---
1 file changed, 11 insertions(+), 3 deletions(-)
diff --git a/fs/dcache.c b/fs/dcache.c
index e9de4d9..33cad8a 100644
--- a/fs/dcache.c
+++ b/fs/dcache.c
@@ -2363,11 +2363,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);
}
/**
--
2.8.0.rc3
Powered by blists - more mailing lists