[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH] Re: JFFS oops on mounting.




This appears to fix it:

Index: intrep.c
===================================================================
RCS file: /home/cvs/mtd/fs/jffs/intrep.c,v
retrieving revision 1.40
diff -u -r1.40 intrep.c
--- intrep.c	2000/08/11 09:16:46	1.40
+++ intrep.c	2000/08/11 14:52:24
@@ -1846,7 +1846,21 @@
 		n = n->range_next;
 	}
 
-	f->size -= node->removed_size;
+	if (node->removed_size > (f->size - node->data_offset)) {
+		/* It's possible that the removed_size is in fact
+		 * greater than the amount of data we actually thought
+		 * were present in the first place - some of the nodes 
+		 * which this node originally obsoleted may already have
+		 * been deleted from the flash by subsequent garbage 
+		 * collection.
+		 *
+		 * If this is the case, don't let f->size go negative.
+		 * Bad things would happen :)
+		 */
+		f->size = node->data_offset;
+	} else {
+		f->size -= node->removed_size;
+	}
 	D3(printk("jffs_delete_data(): f->size = %d\n", f->size));
 	return 0;
 } /* jffs_delete_data()  */

--
dwmw2