summaryrefslogtreecommitdiffstats
path: root/fs
diff options
context:
space:
mode:
authorMiklos Szeredi <mszeredi@suse.cz>2009-12-03 15:58:56 -0500
committerTrond Myklebust <Trond.Myklebust@netapp.com>2009-12-03 15:58:56 -0500
commit28f79a1a695e7a5b00af3b6713b449e08581ffbb (patch)
treee843f269eebb716a69a71dd51fec769c30d6efc9 /fs
parente48de5ec25b37d42292c876c1d3337766aae89bd (diff)
downloadlinux-28f79a1a695e7a5b00af3b6713b449e08581ffbb.tar.gz
linux-28f79a1a695e7a5b00af3b6713b449e08581ffbb.tar.bz2
linux-28f79a1a695e7a5b00af3b6713b449e08581ffbb.zip
nfs: fix comments in nfs_rename()
Comments are wrong or out of date. In particular d_drop() doesn't free the inode it just unhashes the dentry. And if target is a directory then it is not checked for being busy. Signed-off-by: Miklos Szeredi <mszeredi@suse.cz> Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
Diffstat (limited to 'fs')
-rw-r--r--fs/nfs/dir.c12
1 files changed, 5 insertions, 7 deletions
diff --git a/fs/nfs/dir.c b/fs/nfs/dir.c
index b5fae1953e9d..11d0c4cffffc 100644
--- a/fs/nfs/dir.c
+++ b/fs/nfs/dir.c
@@ -1581,7 +1581,7 @@ static int nfs_rename(struct inode *old_dir, struct dentry *old_dentry,
/*
* To prevent any new references to the target during the rename,
- * we unhash the dentry and free the inode in advance.
+ * we unhash the dentry in advance.
*/
if (!d_unhashed(new_dentry)) {
d_drop(new_dentry);
@@ -1594,12 +1594,10 @@ static int nfs_rename(struct inode *old_dir, struct dentry *old_dentry,
atomic_read(&new_dentry->d_count));
/*
- * First check whether the target is busy ... we can't
- * safely do _any_ rename if the target is in use.
- *
- * For files, make a copy of the dentry and then do a
- * silly-rename. If the silly-rename succeeds, the
- * copied dentry is hashed and becomes the new target.
+ * For non-directories, check whether the target is busy and if so,
+ * make a copy of the dentry and then do a silly-rename. If the
+ * silly-rename succeeds, the copied dentry is hashed and becomes
+ * the new target.
*/
if (new_inode && !S_ISDIR(new_inode->i_mode) &&
atomic_read(&new_dentry->d_count) > 2) {