aboutsummaryrefslogtreecommitdiffstats
path: root/fs/namei.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/namei.c')
-rw-r--r--fs/namei.c12
1 files changed, 5 insertions, 7 deletions
diff --git a/fs/namei.c b/fs/namei.c
index b52bc685465f..0b3138de2a3b 100644
--- a/fs/namei.c
+++ b/fs/namei.c
@@ -721,12 +721,6 @@ static int follow_automount(struct path *path, unsigned flags,
721 if (!path->dentry->d_op || !path->dentry->d_op->d_automount) 721 if (!path->dentry->d_op || !path->dentry->d_op->d_automount)
722 return -EREMOTE; 722 return -EREMOTE;
723 723
724 /* We don't want to mount if someone supplied AT_NO_AUTOMOUNT
725 * and this is the terminal part of the path.
726 */
727 if ((flags & LOOKUP_NO_AUTOMOUNT) && !(flags & LOOKUP_PARENT))
728 return -EISDIR; /* we actually want to stop here */
729
730 /* We don't want to mount if someone's just doing a stat - 724 /* We don't want to mount if someone's just doing a stat -
731 * unless they're stat'ing a directory and appended a '/' to 725 * unless they're stat'ing a directory and appended a '/' to
732 * the name. 726 * the name.
@@ -739,7 +733,7 @@ static int follow_automount(struct path *path, unsigned flags,
739 * of the daemon to instantiate them before they can be used. 733 * of the daemon to instantiate them before they can be used.
740 */ 734 */
741 if (!(flags & (LOOKUP_PARENT | LOOKUP_DIRECTORY | 735 if (!(flags & (LOOKUP_PARENT | LOOKUP_DIRECTORY |
742 LOOKUP_OPEN | LOOKUP_CREATE)) && 736 LOOKUP_OPEN | LOOKUP_CREATE | LOOKUP_AUTOMOUNT)) &&
743 path->dentry->d_inode) 737 path->dentry->d_inode)
744 return -EISDIR; 738 return -EISDIR;
745 739
@@ -2616,6 +2610,7 @@ int vfs_rmdir(struct inode *dir, struct dentry *dentry)
2616 if (!dir->i_op->rmdir) 2610 if (!dir->i_op->rmdir)
2617 return -EPERM; 2611 return -EPERM;
2618 2612
2613 dget(dentry);
2619 mutex_lock(&dentry->d_inode->i_mutex); 2614 mutex_lock(&dentry->d_inode->i_mutex);
2620 2615
2621 error = -EBUSY; 2616 error = -EBUSY;
@@ -2636,6 +2631,7 @@ int vfs_rmdir(struct inode *dir, struct dentry *dentry)
2636 2631
2637out: 2632out:
2638 mutex_unlock(&dentry->d_inode->i_mutex); 2633 mutex_unlock(&dentry->d_inode->i_mutex);
2634 dput(dentry);
2639 if (!error) 2635 if (!error)
2640 d_delete(dentry); 2636 d_delete(dentry);
2641 return error; 2637 return error;
@@ -3025,6 +3021,7 @@ static int vfs_rename_dir(struct inode *old_dir, struct dentry *old_dentry,
3025 if (error) 3021 if (error)
3026 return error; 3022 return error;
3027 3023
3024 dget(new_dentry);
3028 if (target) 3025 if (target)
3029 mutex_lock(&target->i_mutex); 3026 mutex_lock(&target->i_mutex);
3030 3027
@@ -3045,6 +3042,7 @@ static int vfs_rename_dir(struct inode *old_dir, struct dentry *old_dentry,
3045out: 3042out:
3046 if (target) 3043 if (target)
3047 mutex_unlock(&target->i_mutex); 3044 mutex_unlock(&target->i_mutex);
3045 dput(new_dentry);
3048 if (!error) 3046 if (!error)
3049 if (!(old_dir->i_sb->s_type->fs_flags & FS_RENAME_DOES_D_MOVE)) 3047 if (!(old_dir->i_sb->s_type->fs_flags & FS_RENAME_DOES_D_MOVE))
3050 d_move(old_dentry,new_dentry); 3048 d_move(old_dentry,new_dentry);