aboutsummaryrefslogtreecommitdiffstats
path: root/fs
diff options
context:
space:
mode:
authorTrond Myklebust <trond.myklebust@fys.uio.no>2005-01-04 21:43:24 +0100
committerTrond Myklebust <trond.myklebust@fys.uio.no>2005-01-04 21:43:24 +0100
commit6fc06ef91e68489d80b2906bb57bd2e7d279e198 (patch)
tree5612c0644642117fb6e029be65dc8a46282b6236 /fs
parent07e9eb2bc26214b844997867bfa9732b5dd3c878 (diff)
downloadhistory-6fc06ef91e68489d80b2906bb57bd2e7d279e198.tar.gz
NFS: Fix dentry refcount accounting error which causes unnecessary
sillyrenames when renaming to an existing file. Signed-off-by: Greg Banks <gnb@melbourne.sgi.com> Signed-off-by: Trond Myklebust <trond.myklebust@fys.uio.no>
Diffstat (limited to 'fs')
-rw-r--r--fs/nfs/dir.c6
1 files changed, 2 insertions, 4 deletions
diff --git a/fs/nfs/dir.c b/fs/nfs/dir.c
index 7dd465690c5fe5..3fd8d94e7ddf7a 100644
--- a/fs/nfs/dir.c
+++ b/fs/nfs/dir.c
@@ -1382,7 +1382,7 @@ static int nfs_rename(struct inode *old_dir, struct dentry *old_dentry,
goto go_ahead;
if (S_ISDIR(new_inode->i_mode))
goto out;
- else if (atomic_read(&new_dentry->d_count) > 1) {
+ else if (atomic_read(&new_dentry->d_count) > 2) {
int err;
/* copy the target dentry's name */
dentry = d_alloc(new_dentry->d_parent,
@@ -1397,10 +1397,8 @@ static int nfs_rename(struct inode *old_dir, struct dentry *old_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 (atomic_read(&new_dentry->d_count) > 1) {
#ifdef NFS_PARANOIA
printk("nfs_rename: target %s/%s busy, d_count=%d\n",
new_dentry->d_parent->d_name.name,