simple_rename, like shmem_rename until I fixed that a few weeks ago,
got the parent directory's link count wrong in the exceptional case
of renaming a directory in place of an existing empty directory.
--- 2.5.42-mm3/fs/libfs.c Tue Oct 15 06:43:39 2002
+++ linux/fs/libfs.c Tue Oct 15 13:14:34 2002
@@ -263,17 +263,16 @@
int simple_rename(struct inode *old_dir, struct dentry *old_dentry,
struct inode *new_dir, struct dentry *new_dentry)
{
- struct inode *inode;
+ int they_are_dirs = S_ISDIR(old_dentry->d_inode->i_mode);
if (!simple_empty(new_dentry))
return -ENOTEMPTY;
- inode = new_dentry->d_inode;
- if (inode) {
- inode->i_nlink--;
- dput(new_dentry);
- }
- if (S_ISDIR(old_dentry->d_inode->i_mode)) {
+ if (new_dentry->d_inode) {
+ simple_unlink(new_dir, new_dentry);
+ if (they_are_dirs)
+ old_dir->i_nlink--;
+ } else if (they_are_dirs) {
old_dir->i_nlink--;
new_dir->i_nlink++;
}
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
This archive was generated by hypermail 2b29 : Tue Oct 15 2002 - 22:00:57 EST