瀏覽代碼

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 <Trond.Myklebust@netapp.com>
Trond Myklebust 19 年之前
父節點
當前提交
20509f1bc5
共有 1 個文件被更改,包括 2 次插入1 次删除
  1. 2 1
      fs/nfs/dir.c

+ 2 - 1
fs/nfs/dir.c

@@ -1539,7 +1539,8 @@ static int nfs_rename(struct inode *old_dir, struct dentry *old_dentry,
 #endif
 #endif
 			goto out;
 			goto out;
 		}
 		}
-	}
+	} else
+		new_inode->i_nlink--;
 
 
 go_ahead:
 go_ahead:
 	/*
 	/*