aboutsummaryrefslogtreecommitdiffstats
path: root/fs/namei.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/namei.c')
-rw-r--r--fs/namei.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/fs/namei.c b/fs/namei.c
index b52bc685465f..f4788365ea22 100644
--- a/fs/namei.c
+++ b/fs/namei.c
@@ -2616,6 +2616,7 @@ int vfs_rmdir(struct inode *dir, struct dentry *dentry)
2616 if (!dir->i_op->rmdir) 2616 if (!dir->i_op->rmdir)
2617 return -EPERM; 2617 return -EPERM;
2618 2618
2619 dget(dentry);
2619 mutex_lock(&dentry->d_inode->i_mutex); 2620 mutex_lock(&dentry->d_inode->i_mutex);
2620 2621
2621 error = -EBUSY; 2622 error = -EBUSY;
@@ -2636,6 +2637,7 @@ int vfs_rmdir(struct inode *dir, struct dentry *dentry)
2636 2637
2637out: 2638out:
2638 mutex_unlock(&dentry->d_inode->i_mutex); 2639 mutex_unlock(&dentry->d_inode->i_mutex);
2640 dput(dentry);
2639 if (!error) 2641 if (!error)
2640 d_delete(dentry); 2642 d_delete(dentry);
2641 return error; 2643 return error;
@@ -3025,6 +3027,7 @@ static int vfs_rename_dir(struct inode *old_dir, struct dentry *old_dentry,
3025 if (error) 3027 if (error)
3026 return error; 3028 return error;
3027 3029
3030 dget(new_dentry);
3028 if (target) 3031 if (target)
3029 mutex_lock(&target->i_mutex); 3032 mutex_lock(&target->i_mutex);
3030 3033
@@ -3045,6 +3048,7 @@ static int vfs_rename_dir(struct inode *old_dir, struct dentry *old_dentry,
3045out: 3048out:
3046 if (target) 3049 if (target)
3047 mutex_unlock(&target->i_mutex); 3050 mutex_unlock(&target->i_mutex);
3051 dput(new_dentry);
3048 if (!error) 3052 if (!error)
3049 if (!(old_dir->i_sb->s_type->fs_flags & FS_RENAME_DOES_D_MOVE)) 3053 if (!(old_dir->i_sb->s_type->fs_flags & FS_RENAME_DOES_D_MOVE))
3050 d_move(old_dentry,new_dentry); 3054 d_move(old_dentry,new_dentry);