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
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,
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;
}