diff options
author | Al Viro <viro@zeniv.linux.org.uk> | 2016-05-17 02:17:59 -0400 |
---|---|---|
committer | Al Viro <viro@zeniv.linux.org.uk> | 2016-05-17 02:17:59 -0400 |
commit | 0e0162bb8c008fa7742f69d4d4982c8a37b88f95 (patch) | |
tree | 4b230ab63b5698a44d2948e70a6cc22405c351e9 /fs/namei.c | |
parent | ae05327a00fd47c34dfe25294b359a3f3fef96e8 (diff) | |
parent | 38b78a5f18584db6fa7441e0f4531b283b0e6725 (diff) | |
download | linux-0e0162bb8c008fa7742f69d4d4982c8a37b88f95.tar.gz linux-0e0162bb8c008fa7742f69d4d4982c8a37b88f95.tar.bz2 linux-0e0162bb8c008fa7742f69d4d4982c8a37b88f95.zip |
Merge branch 'ovl-fixes' into for-linus
Backmerge to resolve a conflict in ovl_lookup_real();
"ovl_lookup_real(): use lookup_one_len_unlocked()" instead,
but it was too late in the cycle to rebase.
Diffstat (limited to 'fs/namei.c')
-rw-r--r-- | fs/namei.c | 39 |
1 files changed, 33 insertions, 6 deletions
diff --git a/fs/namei.c b/fs/namei.c index 01069ddda3e3..31c2e0f5d6d6 100644 --- a/fs/namei.c +++ b/fs/namei.c @@ -2277,6 +2277,33 @@ int vfs_path_lookup(struct dentry *dentry, struct vfsmount *mnt, EXPORT_SYMBOL(vfs_path_lookup); /** + * 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(const struct qstr *name, struct dentry *base) +{ + struct dentry *ret; + + ret = lookup_dcache(name, base, 0); + if (!ret) + ret = lookup_slow(name, base, 0); + + return ret; +} +EXPORT_SYMBOL(lookup_hash); + +/** * lookup_one_len - filesystem helper to lookup single pathname component * @name: pathname component to lookup * @base: base directory to lookup from @@ -2347,7 +2374,6 @@ struct dentry *lookup_one_len_unlocked(const char *name, struct qstr this; unsigned int c; int err; - struct dentry *ret; this.name = name; this.len = len; @@ -2379,10 +2405,7 @@ struct dentry *lookup_one_len_unlocked(const char *name, if (err) return ERR_PTR(err); - ret = lookup_dcache(&this, base, 0); - if (!ret) - ret = lookup_slow(&this, base, 0); - return ret; + return lookup_hash(&this, base); } EXPORT_SYMBOL(lookup_one_len_unlocked); @@ -4190,7 +4213,11 @@ int vfs_rename(struct inode *old_dir, struct dentry *old_dentry, bool new_is_dir = false; unsigned max_links = new_dir->i_sb->s_max_links; - if (source == target) + /* + * Check source == target. + * On overlayfs need to look at underlying inodes. + */ + if (vfs_select_inode(old_dentry, 0) == vfs_select_inode(new_dentry, 0)) return 0; error = may_delete(old_dir, old_dentry, is_dir); |