Skip to content

Commit

Permalink
nfs: clean up sillyrenaming in nfs_rename()
Browse files Browse the repository at this point in the history
The d_instantiate(new_dentry, NULL) is superfluous, the dentry is
already negative.  Rehashing this dummy dentry isn't needed either,
d_move() works fine on an unhashed target.

The re-checking for busy after a failed nfs_sillyrename() is bogus
too: new_dentry->d_count < 2 would be a bug here.

Signed-off-by: Miklos Szeredi <mszeredi@suse.cz>
Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
  • Loading branch information
Miklos Szeredi authored and Trond Myklebust committed Dec 3, 2009
1 parent 2722610 commit 24e9302
Showing 1 changed file with 4 additions and 7 deletions.
11 changes: 4 additions & 7 deletions fs/nfs/dir.c
Original file line number Diff line number Diff line change
Expand Up @@ -1611,14 +1611,11 @@ static int nfs_rename(struct inode *old_dir, struct dentry *old_dentry,

/* silly-rename the existing target ... */
err = nfs_sillyrename(new_dir, new_dentry);
if (!err) {
new_dentry = rehash = dentry;
new_inode = NULL;
/* instantiate the replacement target */
d_instantiate(new_dentry, NULL);
} else if (atomic_read(&new_dentry->d_count) > 1)
/* dentry still busy? */
if (err)
goto out;

new_dentry = dentry;
new_inode = NULL;
}
}

Expand Down

0 comments on commit 24e9302

Please sign in to comment.