mtd/fs/jffs2 gc.c,1.52.2.2,1.52.2.3
David Woodhouse
dwmw2 at infradead.org
Sun May 12 13:27:11 EDT 2002
Update of /home/cvs/mtd/fs/jffs2
In directory phoenix.infradead.org:/tmp/cvs-serv26385
Modified Files:
Tag: jffs2-2_4-branch
gc.c
Log Message:
Fix double free in jffs2_garbage_collect_hole(), where it would call
jffs2_add_full_dnode_to_inode() for the newly-written hole node, then
go ahead and free the old node itself, even though it would have been
freed already.
Index: gc.c
===================================================================
RCS file: /home/cvs/mtd/fs/jffs2/gc.c,v
retrieving revision 1.52.2.2
retrieving revision 1.52.2.3
diff -u -r1.52.2.2 -r1.52.2.3
--- gc.c 23 Feb 2002 14:25:36 -0000 1.52.2.2
+++ gc.c 12 May 2002 17:27:08 -0000 1.52.2.3
@@ -497,9 +497,21 @@
jffs2_mark_node_obsolete(c, f->metadata->raw);
jffs2_free_full_dnode(f->metadata);
f->metadata = NULL;
- return 0;
}
+ return 0;
}
+
+ /*
+ * We should only get here in the case where the node we are
+ * replacing had more than one frag, so we kept the same version
+ * number as before. (Except in case of error -- see 'goto fill;'
+ * above.)
+ */
+ D1(if(unlikely(fn->frags <= 1)) {
+ printk(KERN_WARNING "jffs2_garbage_collect_hole: Replacing fn with %d frag(s) but new ver %d != highest_version %d of ino #%d\n",
+ fn->frags, ri.version, f->highest_version, ri.ino);
+ });
+
for (frag = f->fraglist; frag; frag = frag->next) {
if (frag->ofs > fn->size + fn->ofs)
break;
More information about the linux-mtd-cvs
mailing list