Commit 28f79a1a authored by Miklos Szeredi's avatar Miklos Szeredi Committed by Trond Myklebust

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: default avatarMiklos Szeredi <mszeredi@suse.cz>
Signed-off-by: default avatarTrond Myklebust <Trond.Myklebust@netapp.com>
parent e48de5ec
...@@ -1581,7 +1581,7 @@ static int nfs_rename(struct inode *old_dir, struct dentry *old_dentry, ...@@ -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, * 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)) { if (!d_unhashed(new_dentry)) {
d_drop(new_dentry); d_drop(new_dentry);
...@@ -1594,12 +1594,10 @@ static int nfs_rename(struct inode *old_dir, struct dentry *old_dentry, ...@@ -1594,12 +1594,10 @@ static int nfs_rename(struct inode *old_dir, struct dentry *old_dentry,
atomic_read(&new_dentry->d_count)); atomic_read(&new_dentry->d_count));
/* /*
* First check whether the target is busy ... we can't * For non-directories, check whether the target is busy and if so,
* safely do _any_ rename if the target is in use. * make a copy of the dentry and then do a silly-rename. If the
* * silly-rename succeeds, the copied dentry is hashed and becomes
* For files, make a copy of the dentry and then do a * the new target.
* 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) && if (new_inode && !S_ISDIR(new_inode->i_mode) &&
atomic_read(&new_dentry->d_count) > 2) { atomic_read(&new_dentry->d_count) > 2) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment