Commit f0bc8350 authored by David Woodhouse's avatar David Woodhouse

JFFS2: Discard dirents which point to non-existent inodes.

If a directory entry refers to an inode which doesn't actually exist,
we weren't marking it obsolete, so it was still visible in the file
system, and would give EIO if you ever tried to stat it. Once upon
a time, perl -e 'unlink' and rm -f would manage to unlink such things
but nowadays they both try to stat it first and stupidly refuse to 
even attempt the unlink if the stat fails, and this is more of a 
problem. So we throw it away ourselves. 
Signed-off-by: default avatarArtem Bityuckiy <dedekind@infradead.org>
Signed-off-by: default avatarDavid Woodhouse <dwmw2@infradead.org>
parent fc0b80cb
......@@ -7,7 +7,7 @@
*
* For licensing information, see the file 'LICENCE' in this directory.
*
* $Id: build.c,v 1.57 2004/11/16 20:36:11 dwmw2 Exp $
* $Id: build.c,v 1.60 2004/11/17 17:13:13 dedekind Exp $
*
*/
......@@ -62,6 +62,7 @@ static inline void jffs2_build_inode_pass1(struct jffs2_sb_info *c, struct jffs2
if (!child_ic) {
printk(KERN_NOTICE "Eep. Child \"%s\" (ino #%u) of dir ino #%u doesn't exist!\n",
fd->name, fd->ino, ic->ino);
jffs2_mark_node_obsolete(c, fd->raw);
continue;
}
......@@ -95,8 +96,6 @@ static int jffs2_build_filesystem(struct jffs2_sb_info *c)
c->flags |= JFFS2_SB_FLAG_MOUNTING;
ret = jffs2_scan_medium(c);
c->flags &= ~JFFS2_SB_FLAG_MOUNTING;
if (ret)
return ret;
......@@ -114,6 +113,8 @@ static int jffs2_build_filesystem(struct jffs2_sb_info *c)
cond_resched();
}
}
c->flags &= ~JFFS2_SB_FLAG_MOUNTING;
D1(printk(KERN_DEBUG "Pass 1 complete\n"));
/* Next, scan for inodes with nlink == 0 and remove them. If
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment