minor fixes
diff --git a/ChangeLog b/ChangeLog
index 969342b..cb4b313 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -6,6 +6,8 @@
printed if the cause of the program exit is that the filesystem
has already been unmounted
+ * Fix i_nlink correctness after rmdir/unlink
+
2004-01-26 Miklos Szeredi <mszeredi@inf.bme.hu>
* Released 1.1-pre2
diff --git a/kernel/dir.c b/kernel/dir.c
index cd41a88..739b677 100644
--- a/kernel/dir.c
+++ b/kernel/dir.c
@@ -272,12 +272,24 @@
static int fuse_unlink(struct inode *dir, struct dentry *entry)
{
- return fuse_remove(dir, entry, FUSE_UNLINK);
+ int err = fuse_remove(dir, entry, FUSE_UNLINK);
+ if(!err) {
+ /* FIXME: the new i_nlink could be returned by the
+ unlink operation */
+ err = fuse_do_getattr(entry->d_inode);
+ if(err == -ENOENT)
+ entry->d_inode->i_nlink = 0;
+ return 0;
+ }
+ return err;
}
static int fuse_rmdir(struct inode *dir, struct dentry *entry)
{
- return fuse_remove(dir, entry, FUSE_RMDIR);
+ int err = fuse_remove(dir, entry, FUSE_RMDIR);
+ if(!err)
+ entry->d_inode->i_nlink = 0;
+ return err;
}
static int fuse_rename(struct inode *olddir, struct dentry *oldent,
diff --git a/lib/fuse.c b/lib/fuse.c
index 50ae3a8..f88653d 100644
--- a/lib/fuse.c
+++ b/lib/fuse.c
@@ -109,8 +109,8 @@
static fino_t next_ino(struct fuse *f)
{
- while(f->ctr == 0 || __get_node(f, f->ctr) != NULL)
- f->ctr++;
+ do f->ctr++;
+ while(f->ctr == 0 || __get_node(f, f->ctr) != NULL);
return f->ctr;
}