diff options
author | Sage Weil <sage@newdream.net> | 2011-05-24 16:06:07 -0400 |
---|---|---|
committer | Al Viro <viro@zeniv.linux.org.uk> | 2011-05-26 07:26:48 -0400 |
commit | e4eaac06bcccb2a70bca6a2de9871882dce2aa14 (patch) | |
tree | ca6736d96294cd6e65a1c3055718bfd5adc7336e /fs/namei.c | |
parent | 79bf7c732b5ff75b96022ed9d29181afd3d2509c (diff) |
vfs: push dentry_unhash on rename_dir into file systems
Only a few file systems need this. Start by pushing it down into each
rename method (except gfs2 and xfs) so that it can be dealt with on a
per-fs basis.
Acked-by: Christoph Hellwig <hch@lst.de>
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.c | 12 |
1 files changed, 2 insertions, 10 deletions
diff --git a/fs/namei.c b/fs/namei.c index 596edb5094a4..787ebc8a200a 100644 --- a/fs/namei.c +++ b/fs/namei.c | |||
@@ -2950,12 +2950,7 @@ SYSCALL_DEFINE2(link, const char __user *, oldname, const char __user *, newname | |||
2950 | * HOWEVER, it relies on the assumption that any object with ->lookup() | 2950 | * HOWEVER, it relies on the assumption that any object with ->lookup() |
2951 | * has no more than 1 dentry. If "hybrid" objects will ever appear, | 2951 | * has no more than 1 dentry. If "hybrid" objects will ever appear, |
2952 | * we'd better make sure that there's no link(2) for them. | 2952 | * we'd better make sure that there's no link(2) for them. |
2953 | * d) some filesystems don't support opened-but-unlinked directories, | 2953 | * d) conversion from fhandle to dentry may come in the wrong moment - when |
2954 | * either because of layout or because they are not ready to deal with | ||
2955 | * all cases correctly. The latter will be fixed (taking this sort of | ||
2956 | * stuff into VFS), but the former is not going away. Solution: the same | ||
2957 | * trick as in rmdir(). | ||
2958 | * e) conversion from fhandle to dentry may come in the wrong moment - when | ||
2959 | * we are removing the target. Solution: we will have to grab ->i_mutex | 2954 | * we are removing the target. Solution: we will have to grab ->i_mutex |
2960 | * in the fhandle_to_dentry code. [FIXME - current nfsfh.c relies on | 2955 | * in the fhandle_to_dentry code. [FIXME - current nfsfh.c relies on |
2961 | * ->i_mutex on parents, which works but leads to some truly excessive | 2956 | * ->i_mutex on parents, which works but leads to some truly excessive |
@@ -2986,11 +2981,8 @@ static int vfs_rename_dir(struct inode *old_dir, struct dentry *old_dentry, | |||
2986 | mutex_lock(&target->i_mutex); | 2981 | mutex_lock(&target->i_mutex); |
2987 | if (d_mountpoint(old_dentry)||d_mountpoint(new_dentry)) | 2982 | if (d_mountpoint(old_dentry)||d_mountpoint(new_dentry)) |
2988 | error = -EBUSY; | 2983 | error = -EBUSY; |
2989 | else { | 2984 | else |
2990 | if (target) | ||
2991 | dentry_unhash(new_dentry); | ||
2992 | error = old_dir->i_op->rename(old_dir, old_dentry, new_dir, new_dentry); | 2985 | error = old_dir->i_op->rename(old_dir, old_dentry, new_dir, new_dentry); |
2993 | } | ||
2994 | if (target) { | 2986 | if (target) { |
2995 | if (!error) { | 2987 | if (!error) { |
2996 | target->i_flags |= S_DEAD; | 2988 | target->i_flags |= S_DEAD; |