mtd/fs/jffs3 nodemgmt.c,3.13,3.14 debug.h,1.21,1.22

hammache at infradead.org hammache at infradead.org
Mon Jan 24 16:44:46 EST 2005


Update of /home/cvs/mtd/fs/jffs3
In directory phoenix.infradead.org:/tmp/cvs-serv25958/mtd/fs/jffs3

Modified Files:
	nodemgmt.c debug.h 
Log Message:
- JFFS2 and NAND failure:
avoid segfault when nextblock was refiled because of a write failure
- avoid filing blocks on the clean list when they have wasted
space



Index: nodemgmt.c
===================================================================
RCS file: /home/cvs/mtd/fs/jffs3/nodemgmt.c,v
retrieving revision 3.13
retrieving revision 3.14
diff -u -r3.13 -r3.14
--- nodemgmt.c	5 Jan 2005 16:19:00 -0000	3.13
+++ nodemgmt.c	24 Jan 2005 21:44:43 -0000	3.14
@@ -426,7 +426,7 @@
 		c->used_size += len;
 	}
 
-	if (!jeb->free_size && !jeb->dirty_size) {
+	if (!jeb->free_size && !jeb->dirty_size && !jeb->wasted_size) {
 		/* If it lives on the dirty_list, jffs3_reserve_space will put it there */
 		DBG_BL(1, "Adding full erase block at 0x%08x to clean_list "
 			"(free 0x%08x, dirty 0x%08x, used 0x%08x\n",

Index: debug.h
===================================================================
RCS file: /home/cvs/mtd/fs/jffs3/debug.h,v
retrieving revision 1.21
retrieving revision 1.22
diff -u -r1.21 -r1.22
--- debug.h	5 Jan 2005 16:19:00 -0000	1.21
+++ debug.h	24 Jan 2005 21:44:43 -0000	1.22
@@ -384,8 +384,11 @@
 	 * During mounting c->nextblock may be uninitialized, so don't
 	 * check it if JFFS3_SB_FLAG_MOUNTING flag is set.
 	 */
-	if (jeb != c->nextblock
-		|| ref_offset(ref) != jeb->offset + (c->sector_size - jeb->free_size)) {
+	/* we could get some obsolete nodes after nextblock was refiled
+	   in wbuf.c */
+	if (  (c->nextblock || !ref_obsolete(ref))
+	    && (jeb != c->nextblock
+		|| ref_offset(ref) != jeb->offset + (c->sector_size - jeb->free_size)) ) {
 		WARNING_MSG("Argh. Node added in wrong place.\n");
 		printk(KERN_ERR "c->nextblock %p, jeb %p, new offs %#08x, new len %#x, "
 			"should be %#08x (jeb->offset %#08x, c->sector_size %#x, "





More information about the linux-mtd-cvs mailing list