NFS: Fix dentry refcount accounting error which causes unnecessary sillyrenames when renaming to an existing file. Signed-off-by: Greg Banks Signed-off-by: Trond Myklebust --- dir.c | 6 ++---- 1 files changed, 2 insertions(+), 4 deletions(-) Index: linux-2.6.9-rc4-up/fs/nfs/dir.c =================================================================== --- linux-2.6.9-rc4-up.orig/fs/nfs/dir.c 2004-10-15 06:03:34.000000000 -0400 +++ linux-2.6.9-rc4-up/fs/nfs/dir.c 2004-10-22 17:14:56.786239035 -0400 @@ -1438,7 +1438,7 @@ static int nfs_rename(struct inode *old_ 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, @@ -1453,10 +1453,8 @@ static int nfs_rename(struct inode *old_ 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,