[prev in list] [next in list] [prev in thread] [next in thread]
List: linux-fsdevel
Subject: Re: [PATCH] Coda: fix for coda_rmdir
From: Miklos.Szeredi () eth ! ericsson ! se (Miklos Szeredi)
Date: 2000-11-10 14:00:48
[Download RAW message or body]
> After rmdir, the inode of the directory isn't cleared. This is because
> the i_nlink filed of an empty directory is 2, and rmdir decreases this
> by one leaving i_nlink = 1, which is incorrect.
>
> The following patch fixes this, and also removes the superfluous
> d_delete(), which is also called in vfs_rmdir().
coda_rename() has the same problem with both files and directories.
The following solves all cases of this (I hope).
Miklos
diff -ru /tmp/linux/linux/fs/coda/dir.c linux/fs/coda/dir.c
--- /tmp/linux/linux/fs/coda/dir.c Mon Oct 16 21:58:51 2000
+++ linux/fs/coda/dir.c Fri Nov 10 14:51:34 2000
@@ -459,8 +459,7 @@
}
coda_dir_changed(dir, -1);
- de->d_inode->i_nlink--;
- d_delete(de);
+ de->d_inode->i_nlink = 0;
return 0;
}
@@ -490,8 +489,12 @@
if ( !error ) {
if ( new_dentry->d_inode ) {
- if ( S_ISDIR(new_dentry->d_inode->i_mode) )
+ if ( S_ISDIR(new_dentry->d_inode->i_mode) ) {
link_adjust = 1;
+ new_dentry->d_inode->i_nlink = 0;
+ }
+ else
+ new_dentry->d_inode->i_nlink--;
coda_dir_changed(old_dir, -link_adjust);
coda_dir_changed(new_dir, link_adjust);
-
To unsubscribe from this list: send the line "unsubscribe linux-fsdevel" in
the body of a message to majordomo@vger.kernel.org
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic