diff options
Diffstat (limited to 'fs/namei.c')
-rw-r--r-- | fs/namei.c | 37 |
1 files changed, 19 insertions, 18 deletions
diff --git a/fs/namei.c b/fs/namei.c index 2826db35dc25..f4788365ea22 100644 --- a/fs/namei.c +++ b/fs/namei.c | |||
@@ -727,25 +727,22 @@ static int follow_automount(struct path *path, unsigned flags, | |||
727 | if ((flags & LOOKUP_NO_AUTOMOUNT) && !(flags & LOOKUP_PARENT)) | 727 | if ((flags & LOOKUP_NO_AUTOMOUNT) && !(flags & LOOKUP_PARENT)) |
728 | return -EISDIR; /* we actually want to stop here */ | 728 | return -EISDIR; /* we actually want to stop here */ |
729 | 729 | ||
730 | /* | 730 | /* We don't want to mount if someone's just doing a stat - |
731 | * We don't want to mount if someone's just doing a stat and they've | 731 | * unless they're stat'ing a directory and appended a '/' to |
732 | * set AT_SYMLINK_NOFOLLOW - unless they're stat'ing a directory and | 732 | * the name. |
733 | * appended a '/' to the name. | 733 | * |
734 | * We do, however, want to mount if someone wants to open or | ||
735 | * create a file of any type under the mountpoint, wants to | ||
736 | * traverse through the mountpoint or wants to open the | ||
737 | * mounted directory. Also, autofs may mark negative dentries | ||
738 | * as being automount points. These will need the attentions | ||
739 | * of the daemon to instantiate them before they can be used. | ||
734 | */ | 740 | */ |
735 | if (!(flags & LOOKUP_FOLLOW)) { | 741 | if (!(flags & (LOOKUP_PARENT | LOOKUP_DIRECTORY | |
736 | /* We do, however, want to mount if someone wants to open or | 742 | LOOKUP_OPEN | LOOKUP_CREATE)) && |
737 | * create a file of any type under the mountpoint, wants to | 743 | path->dentry->d_inode) |
738 | * traverse through the mountpoint or wants to open the mounted | 744 | return -EISDIR; |
739 | * directory. | 745 | |
740 | * Also, autofs may mark negative dentries as being automount | ||
741 | * points. These will need the attentions of the daemon to | ||
742 | * instantiate them before they can be used. | ||
743 | */ | ||
744 | if (!(flags & (LOOKUP_PARENT | LOOKUP_DIRECTORY | | ||
745 | LOOKUP_OPEN | LOOKUP_CREATE)) && | ||
746 | path->dentry->d_inode) | ||
747 | return -EISDIR; | ||
748 | } | ||
749 | current->total_link_count++; | 746 | current->total_link_count++; |
750 | if (current->total_link_count >= 40) | 747 | if (current->total_link_count >= 40) |
751 | return -ELOOP; | 748 | return -ELOOP; |
@@ -2619,6 +2616,7 @@ int vfs_rmdir(struct inode *dir, struct dentry *dentry) | |||
2619 | if (!dir->i_op->rmdir) | 2616 | if (!dir->i_op->rmdir) |
2620 | return -EPERM; | 2617 | return -EPERM; |
2621 | 2618 | ||
2619 | dget(dentry); | ||
2622 | mutex_lock(&dentry->d_inode->i_mutex); | 2620 | mutex_lock(&dentry->d_inode->i_mutex); |
2623 | 2621 | ||
2624 | error = -EBUSY; | 2622 | error = -EBUSY; |
@@ -2639,6 +2637,7 @@ int vfs_rmdir(struct inode *dir, struct dentry *dentry) | |||
2639 | 2637 | ||
2640 | out: | 2638 | out: |
2641 | mutex_unlock(&dentry->d_inode->i_mutex); | 2639 | mutex_unlock(&dentry->d_inode->i_mutex); |
2640 | dput(dentry); | ||
2642 | if (!error) | 2641 | if (!error) |
2643 | d_delete(dentry); | 2642 | d_delete(dentry); |
2644 | return error; | 2643 | return error; |
@@ -3028,6 +3027,7 @@ static int vfs_rename_dir(struct inode *old_dir, struct dentry *old_dentry, | |||
3028 | if (error) | 3027 | if (error) |
3029 | return error; | 3028 | return error; |
3030 | 3029 | ||
3030 | dget(new_dentry); | ||
3031 | if (target) | 3031 | if (target) |
3032 | mutex_lock(&target->i_mutex); | 3032 | mutex_lock(&target->i_mutex); |
3033 | 3033 | ||
@@ -3048,6 +3048,7 @@ static int vfs_rename_dir(struct inode *old_dir, struct dentry *old_dentry, | |||
3048 | out: | 3048 | out: |
3049 | if (target) | 3049 | if (target) |
3050 | mutex_unlock(&target->i_mutex); | 3050 | mutex_unlock(&target->i_mutex); |
3051 | dput(new_dentry); | ||
3051 | if (!error) | 3052 | if (!error) |
3052 | 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)) |
3053 | d_move(old_dentry,new_dentry); | 3054 | d_move(old_dentry,new_dentry); |