Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 251693
b: refs/heads/master
c: 51892bb
h: refs/heads/master
i:
  251691: 4fd0b08
v: v3
  • Loading branch information
Sage Weil authored and Al Viro committed May 26, 2011
1 parent bde9c6f commit d40760a
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 12 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 9055cba711891a6313232629cd6bbca7c901e07f
refs/heads/master: 51892bbb57e87854c27c105317797823f8891e68
25 changes: 14 additions & 11 deletions trunk/fs/namei.c
Original file line number Diff line number Diff line change
Expand Up @@ -3006,27 +3006,30 @@ static int vfs_rename_dir(struct inode *old_dir, struct dentry *old_dentry,
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);
if (error)
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);
Expand Down

0 comments on commit d40760a

Please sign in to comment.