diff options
-rw-r--r-- | ChangeLog | 2 | ||||
-rw-r--r-- | kernel/dir.c | 16 | ||||
-rw-r--r-- | lib/fuse.c | 4 |
3 files changed, 18 insertions, 4 deletions
@@ -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_remove(struct inode *dir, struct dentry *entry, 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, @@ -109,8 +109,8 @@ static fino_t get_ino(struct node *node) 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; } |