Browse Source

make lookup_one_len() safe to use with directory locked shared

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Al Viro 7 years ago
parent
commit
8613a209ff
1 changed files with 3 additions and 1 deletions
  1. 3 1
      fs/namei.c

+ 3 - 1
fs/namei.c

@@ -2471,6 +2471,7 @@ static int lookup_one_len_common(const char *name, struct dentry *base,
  */
  */
 struct dentry *lookup_one_len(const char *name, struct dentry *base, int len)
 struct dentry *lookup_one_len(const char *name, struct dentry *base, int len)
 {
 {
+	struct dentry *dentry;
 	struct qstr this;
 	struct qstr this;
 	int err;
 	int err;
 
 
@@ -2480,7 +2481,8 @@ struct dentry *lookup_one_len(const char *name, struct dentry *base, int len)
 	if (err)
 	if (err)
 		return ERR_PTR(err);
 		return ERR_PTR(err);
 
 
-	return __lookup_hash(&this, base, 0);
+	dentry = lookup_dcache(&this, base, 0);
+	return dentry ? dentry : __lookup_slow(&this, base, 0);
 }
 }
 EXPORT_SYMBOL(lookup_one_len);
 EXPORT_SYMBOL(lookup_one_len);