getdents64 problem in 2.6.23

Joakim Tjernlund joakim.tjernlund at transmode.se
Sat Oct 27 11:01:57 EDT 2007


 

> -----Original Message-----
> From: David Woodhouse [mailto:dwmw2 at infradead.org] 
> Sent: den 27 oktober 2007 14:44
> To: joakim.tjernlund at transmode.se
> Cc: 'Linux-MTD Mailing List'
> Subject: RE: getdents64 problem in 2.6.23
> 
> 
> 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.

How do I do that? I can try booting it, but it has to wait until
I get acces to my board again, hopefully tonight.

What about locking? No need for down(&dir_f->sem)? Can I trust
that ->next ptr will be valid all the time?

 Jocke
> 
> > +       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.

ehh, better add an if (!(*prev)->raw) test
before jffs2_free_full_dirent(*prev) then. Will clean it up too.

 Jocke




More information about the linux-mtd mailing list