From: Trond Myklebust Date: Thu, 25 Aug 2005 23:25:34 +0000 (-0700) Subject: NFS: Drop inode after rename X-Git-Tag: v2.6.15-rc1~733^2~95 X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=20509f1bc553ed7fafa88fa8d01c6212d1876d9f;p=linux-2.6 NFS: Drop inode after rename When doing a rename on top of an existing file that is not in use, the inode of the overwritten file will remain in the icache. The fix is to decrement i_nlink of the overwritten inode, like we do for unlink, rmdir etc already. Problem diagnosed by Olaf Kirch. This patch is a slight variation on his fix. Signed-off-by: Trond Myklebust --- diff --git a/fs/nfs/dir.c b/fs/nfs/dir.c index 2df639f143..94a7fcee06 100644 --- a/fs/nfs/dir.c +++ b/fs/nfs/dir.c @@ -1539,7 +1539,8 @@ static int nfs_rename(struct inode *old_dir, struct dentry *old_dentry, #endif goto out; } - } + } else + new_inode->i_nlink--; go_ahead: /*