aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2016-07-29 15:17:52 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2016-07-29 15:17:52 -0400
commit20d00ee829428ea6aab77fa3acca048a6f57d3bc (patch)
tree8a4813c0adc05186e4fa45465a469400443a8e42
parente7b4f2d8edbbc58c8e2c3134ff884611433ba3db (diff)
Revert "vfs: add lookup_hash() helper"
This reverts commit 3c9fe8cdff1b889a059a30d22f130372f2b3885f. As Miklos points out in commit c1b2cc1a765a, the "lookup_hash()" helper is now unused, and in fact, with the hash salting changes, since the hash of a dentry name now depends on the directory dentry it is in, the helper function isn't even really likely to be useful. So rather than keep it around in case somebody else might end up finding a use for it, let's just remove the helper and not trick people into thinking it might be a useful thing. For example, I had obviously completely missed how the helper didn't follow the normal dentry hashing patterns, and how the hash salting patch broke overlayfs. Things would quietly build and look sane, but not work. Suggested-by: Miklos Szeredi <mszeredi@redhat.com> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
-rw-r--r--fs/namei.c33
-rw-r--r--include/linux/namei.h2
2 files changed, 5 insertions, 30 deletions
diff --git a/fs/namei.c b/fs/namei.c
index ecb0b439747e..68a896c804b7 100644
--- a/fs/namei.c
+++ b/fs/namei.c
@@ -2396,33 +2396,6 @@ int vfs_path_lookup(struct dentry *dentry, struct vfsmount *mnt,
2396EXPORT_SYMBOL(vfs_path_lookup); 2396EXPORT_SYMBOL(vfs_path_lookup);
2397 2397
2398/** 2398/**
2399 * lookup_hash - lookup single pathname component on already hashed name
2400 * @name: name and hash to lookup
2401 * @base: base directory to lookup from
2402 *
2403 * The name must have been verified and hashed (see lookup_one_len()). Using
2404 * this after just full_name_hash() is unsafe.
2405 *
2406 * This function also doesn't check for search permission on base directory.
2407 *
2408 * Use lookup_one_len_unlocked() instead, unless you really know what you are
2409 * doing.
2410 *
2411 * Do not hold i_mutex; this helper takes i_mutex if necessary.
2412 */
2413struct dentry *lookup_hash(const struct qstr *name, struct dentry *base)
2414{
2415 struct dentry *ret;
2416
2417 ret = lookup_dcache(name, base, 0);
2418 if (!ret)
2419 ret = lookup_slow(name, base, 0);
2420
2421 return ret;
2422}
2423EXPORT_SYMBOL(lookup_hash);
2424
2425/**
2426 * lookup_one_len - filesystem helper to lookup single pathname component 2399 * lookup_one_len - filesystem helper to lookup single pathname component
2427 * @name: pathname component to lookup 2400 * @name: pathname component to lookup
2428 * @base: base directory to lookup from 2401 * @base: base directory to lookup from
@@ -2493,6 +2466,7 @@ struct dentry *lookup_one_len_unlocked(const char *name,
2493 struct qstr this; 2466 struct qstr this;
2494 unsigned int c; 2467 unsigned int c;
2495 int err; 2468 int err;
2469 struct dentry *ret;
2496 2470
2497 this.name = name; 2471 this.name = name;
2498 this.len = len; 2472 this.len = len;
@@ -2524,7 +2498,10 @@ struct dentry *lookup_one_len_unlocked(const char *name,
2524 if (err) 2498 if (err)
2525 return ERR_PTR(err); 2499 return ERR_PTR(err);
2526 2500
2527 return lookup_hash(&this, base); 2501 ret = lookup_dcache(&this, base, 0);
2502 if (!ret)
2503 ret = lookup_slow(&this, base, 0);
2504 return ret;
2528} 2505}
2529EXPORT_SYMBOL(lookup_one_len_unlocked); 2506EXPORT_SYMBOL(lookup_one_len_unlocked);
2530 2507
diff --git a/include/linux/namei.h b/include/linux/namei.h
index d3d0398f2a1b..f29abda31e6d 100644
--- a/include/linux/namei.h
+++ b/include/linux/namei.h
@@ -81,8 +81,6 @@ extern int kern_path_mountpoint(int, const char *, struct path *, unsigned int);
81 81
82extern struct dentry *lookup_one_len(const char *, struct dentry *, int); 82extern struct dentry *lookup_one_len(const char *, struct dentry *, int);
83extern struct dentry *lookup_one_len_unlocked(const char *, struct dentry *, int); 83extern struct dentry *lookup_one_len_unlocked(const char *, struct dentry *, int);
84struct qstr;
85extern struct dentry *lookup_hash(const struct qstr *, struct dentry *);
86 84
87extern int follow_down_one(struct path *); 85extern int follow_down_one(struct path *);
88extern int follow_down(struct path *); 86extern int follow_down(struct path *);