@@ -1537,6 +1537,32 @@ static struct dentry *__lookup_hash(struct qstr *name,
return lookup_real(base->d_inode, dentry, flags);
}
+/**
+ * lookup_hash - lookup single pathname component on already hashed name
+ * @name: name and hash to lookup
+ * @base: base directory to lookup from
+ *
+ * The name must have been verified and hashed (see lookup_one_len()). Using
+ * this after just full_name_hash() is unsafe.
+ *
+ * This function also doesn't check for search permission on base directory.
+ *
+ * Use lookup_one_len_unlocked() instead, unless you really know what you are
+ * doing.
+ *
+ * Do not hold i_mutex; this helper takes i_mutex if necessary.
+ */
+struct dentry *lookup_hash(struct qstr *name, struct dentry *base)
+{
+ struct dentry *dentry;
+
+ mutex_lock(&base->d_inode->i_mutex);
+ dentry = __lookup_hash(name, base, 0);
+ mutex_unlock(&base->d_inode->i_mutex);
+ return dentry;
+}
+EXPORT_SYMBOL(lookup_hash);
+
/*
* It's more convoluted than I'd like it to be, but... it's still fairly
* small and for now I'd prefer to have fast path as straight as possible.
@@ -77,6 +77,8 @@ extern struct dentry *kern_path_locked(const char *, struct path *);
extern int kern_path_mountpoint(int, const char *, struct path *, unsigned int);
extern struct dentry *lookup_one_len(const char *, struct dentry *, int);
+struct qstr;
+extern struct dentry *lookup_hash(struct qstr *, struct dentry *);
extern int follow_down_one(struct path *);
extern int follow_down(struct path *);