浏览代码

now lock_parent() can't run into killed dentry

all remaining callers hold either a reference or ->i_lock

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Al Viro 7 年之前
父节点
当前提交
65d8eb5a8f
共有 1 个文件被更改,包括 3 次插入10 次删除
  1. 3 10
      fs/dcache.c

+ 3 - 10
fs/dcache.c

@@ -593,8 +593,6 @@ static inline struct dentry *lock_parent(struct dentry *dentry)
 	struct dentry *parent = dentry->d_parent;
 	struct dentry *parent = dentry->d_parent;
 	if (IS_ROOT(dentry))
 	if (IS_ROOT(dentry))
 		return NULL;
 		return NULL;
-	if (unlikely(dentry->d_lockref.count < 0))
-		return NULL;
 	if (likely(spin_trylock(&parent->d_lock)))
 	if (likely(spin_trylock(&parent->d_lock)))
 		return parent;
 		return parent;
 	rcu_read_lock();
 	rcu_read_lock();
@@ -614,16 +612,11 @@ again:
 		spin_unlock(&parent->d_lock);
 		spin_unlock(&parent->d_lock);
 		goto again;
 		goto again;
 	}
 	}
-	if (parent != dentry) {
+	rcu_read_unlock();
+	if (parent != dentry)
 		spin_lock_nested(&dentry->d_lock, DENTRY_D_LOCK_NESTED);
 		spin_lock_nested(&dentry->d_lock, DENTRY_D_LOCK_NESTED);
-		if (unlikely(dentry->d_lockref.count < 0)) {
-			spin_unlock(&parent->d_lock);
-			parent = NULL;
-		}
-	} else {
+	else
 		parent = NULL;
 		parent = NULL;
-	}
-	rcu_read_unlock();
 	return parent;
 	return parent;
 }
 }