summaryrefslogtreecommitdiffstats
path: root/fs/namei.c
diff options
context:
space:
mode:
authorSage Weil <sage@newdream.net>2011-05-24 13:06:13 -0700
committerAl Viro <viro@zeniv.linux.org.uk>2011-05-26 07:26:53 -0400
commit51892bbb57e87854c27c105317797823f8891e68 (patch)
tree8d7fd27631bc868ebac7de8c3baaab7a8111591b /fs/namei.c
parent9055cba711891a6313232629cd6bbca7c901e07f (diff)
downloadop-kernel-dev-51892bbb57e87854c27c105317797823f8891e68.zip
op-kernel-dev-51892bbb57e87854c27c105317797823f8891e68.tar.gz
vfs: clean up vfs_rename_other
Simplify control flow to match vfs_rename_dir. Signed-off-by: Sage Weil <sage@newdream.net> Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'fs/namei.c')
-rw-r--r--fs/namei.c25
1 files changed, 14 insertions, 11 deletions
diff --git a/fs/namei.c b/fs/namei.c
index ecb16d3..f90f059 100644
--- a/fs/namei.c
+++ b/fs/namei.c
@@ -3006,7 +3006,7 @@ out:
static int vfs_rename_other(struct inode *old_dir, struct dentry *old_dentry,
struct inode *new_dir, struct dentry *new_dentry)
{
- struct inode *target;
+ struct inode *target = new_dentry->d_inode;
int error;
error = security_inode_rename(old_dir, old_dentry, new_dir, new_dentry);
@@ -3014,19 +3014,22 @@ static int vfs_rename_other(struct inode *old_dir, struct dentry *old_dentry,
return error;
dget(new_dentry);
- target = new_dentry->d_inode;
if (target)
mutex_lock(&target->i_mutex);
+
+ error = -EBUSY;
if (d_mountpoint(old_dentry)||d_mountpoint(new_dentry))
- error = -EBUSY;
- else
- error = old_dir->i_op->rename(old_dir, old_dentry, new_dir, new_dentry);
- if (!error) {
- if (target)
- dont_mount(new_dentry);
- if (!(old_dir->i_sb->s_type->fs_flags & FS_RENAME_DOES_D_MOVE))
- d_move(old_dentry, new_dentry);
- }
+ goto out;
+
+ error = old_dir->i_op->rename(old_dir, old_dentry, new_dir, new_dentry);
+ if (error)
+ goto out;
+
+ if (target)
+ dont_mount(new_dentry);
+ if (!(old_dir->i_sb->s_type->fs_flags & FS_RENAME_DOES_D_MOVE))
+ d_move(old_dentry, new_dentry);
+out:
if (target)
mutex_unlock(&target->i_mutex);
dput(new_dentry);
OpenPOWER on IntegriCloud