getdents64 problem in 2.6.23

David Woodhouse dwmw2 at infradead.org
Sat Oct 27 08:44:29 EDT 2007


On Sat, 2007-10-27 at 13:02 +0200, Joakim Tjernlund wrote:
> 
> +static int jffs2_release(struct inode *dir_i, struct file *file)
> +{
> +       //struct jffs2_sb_info *c = JFFS2_SB_INFO(dir_i->i_sb);
> +       struct jffs2_inode_info *dir_f = JFFS2_INODE_INFO(dir_i);
> +       struct jffs2_full_dirent **prev = &dir_f->dents;
> +
> +       if (atomic_read(&dir_i->i_count))
> +               return 0;

That's certainly what I was thinking -- but do check that it's right.
It's possible that you'll have to do refcounting some other way.

> +       while (*prev) {
> +               D1(printk(KERN_DEBUG "Releasing directory inode:%d\n", (*prev)->ino));
> +
> +               jffs2_free_full_dirent(*prev);
> +               prev = &((*prev)->next);
> +       }

That'll kill _everything_, so if the inode is subsequently reopened
before it's pruned from the icache, it'll appear empty. You were only
supposed to remove the dirents where fd->raw == NULL; the ones which
were acting as 'placeholders' to keep seeks in the directory's opened
filedescriptors working consistently.

-- 
dwmw2




More information about the linux-mtd mailing list