summaryrefslogtreecommitdiffstats
path: root/fs/overlayfs
diff options
context:
space:
mode:
authorMiklos Szeredi <mszeredi@redhat.com>2016-12-16 11:02:55 +0100
committerMiklos Szeredi <mszeredi@redhat.com>2016-12-16 11:02:55 +0100
commit804032fabb3b5270a7bc355f478eed45b1a5b041 (patch)
treebb93fe2b08b09092e5e8a365ce1bb17294329de1 /fs/overlayfs
parentca4c8a3a800039c2681d609c5b7491c1bd17c0a7 (diff)
downloadlinux-804032fabb3b5270a7bc355f478eed45b1a5b041.tar.gz
linux-804032fabb3b5270a7bc355f478eed45b1a5b041.tar.bz2
linux-804032fabb3b5270a7bc355f478eed45b1a5b041.zip
ovl: don't check rename to self
This is redundant, the vfs already performed this check (and was broken, see commit 9409e22acdfc ("vfs: rename: check backing inode being equal")). Signed-off-by: Miklos Szeredi <mszeredi@redhat.com>
Diffstat (limited to 'fs/overlayfs')
-rw-r--r--fs/overlayfs/dir.c15
1 files changed, 3 insertions, 12 deletions
diff --git a/fs/overlayfs/dir.c b/fs/overlayfs/dir.c
index 4ef0d539b097..a806fb168ea3 100644
--- a/fs/overlayfs/dir.c
+++ b/fs/overlayfs/dir.c
@@ -826,18 +826,6 @@ static int ovl_rename(struct inode *olddir, struct dentry *old,
err = -EXDEV;
if (!overwrite && OVL_TYPE_MERGE_OR_LOWER(new_type) && new_is_dir)
goto out;
-
- err = 0;
- if (!OVL_TYPE_UPPER(new_type) && !OVL_TYPE_UPPER(old_type)) {
- if (ovl_dentry_lower(old)->d_inode ==
- ovl_dentry_lower(new)->d_inode)
- goto out;
- }
- if (OVL_TYPE_UPPER(new_type) && OVL_TYPE_UPPER(old_type)) {
- if (ovl_dentry_upper(old)->d_inode ==
- ovl_dentry_upper(new)->d_inode)
- goto out;
- }
} else {
if (ovl_dentry_is_opaque(new))
new_type = __OVL_PATH_UPPER;
@@ -933,6 +921,9 @@ static int ovl_rename(struct inode *olddir, struct dentry *old,
if (newdentry == trap)
goto out_dput;
+ if (WARN_ON(olddentry->d_inode == newdentry->d_inode))
+ goto out_dput;
+
if (is_dir && !old_opaque && new_opaque) {
err = ovl_set_opaque(olddentry);
if (err)