[Devel] [PATCH rh7 08/14] move the call of __d_drop(anon) into __d_materialise_unique(dentry, anon)

Andrey Ryabinin aryabinin at virtuozzo.com
Mon Jun 10 18:13:54 MSK 2019


From: Al Viro <viro at zeniv.linux.org.uk>

and lock the right list there

Cc: stable at vger.kernel.org
Signed-off-by: Al Viro <viro at zeniv.linux.org.uk>

Maybe fixes https://jira.sw.ru/browse/PSBM-95177 ????
(cherry picked from commit 6f18493e541c690169c3b1479d47d95f624161cf)
Signed-off-by: Andrey Ryabinin <aryabinin at virtuozzo.com>
---
 fs/dcache.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/fs/dcache.c b/fs/dcache.c
index f4b30d5d2a45..d01631c62ddb 100644
--- a/fs/dcache.c
+++ b/fs/dcache.c
@@ -2772,6 +2772,12 @@ static void __d_materialise_dentry(struct dentry *dentry, struct dentry *anon)
 	list_del_init(&dentry->d_u.d_child);
 	anon->d_flags |= DCACHE_RCUACCESS;
 	anon->d_parent = dparent;
+	if (likely(!d_unhashed(anon))) {
+		hlist_bl_lock(&anon->d_sb->s_anon);
+		__hlist_bl_del(&anon->d_hash);
+		anon->d_hash.pprev = NULL;
+		hlist_bl_unlock(&anon->d_sb->s_anon);
+	}
 	list_move(&anon->d_u.d_child, &dparent->d_subdirs);
 
 	write_seqcount_end(&dentry->d_seq);
@@ -2825,7 +2831,6 @@ struct dentry *d_splice_alias(struct inode *inode, struct dentry *dentry)
 			write_seqlock(&rename_lock);
 			__d_materialise_dentry(dentry, new);
 			write_sequnlock(&rename_lock);
-			__d_drop(new);
 			_d_rehash(new);
 			spin_unlock(&new->d_lock);
 			spin_unlock(&inode->i_lock);
@@ -2889,7 +2894,6 @@ struct dentry *d_materialise_unique(struct dentry *dentry, struct inode *inode)
 				 * could splice into our tree? */
 				__d_materialise_dentry(dentry, alias);
 				write_sequnlock(&rename_lock);
-				__d_drop(alias);
 				goto found;
 			} else {
 				/* Nope, but we must(!) avoid directory
-- 
2.21.0



More information about the Devel mailing list