JFFS2 corruption

David Woodhouse dwmw2 at infradead.org
Sun Feb 8 06:28:30 EST 2004


On Thu, 2004-02-05 at 14:15 +0100, Florian Schirmer wrote:
> i'm having a strange problem with a JFFS2 filesystem: I always get messages
> about incorrect CRC values while mounting the filesystem. What i did:

Also apply this.

Index: fs/jffs2/write.c
===================================================================
RCS file: /home/cvs/mtd/fs/jffs2/write.c,v
retrieving revision 1.80
diff -u -p -r1.80 write.c
--- fs/jffs2/write.c	27 Jan 2004 13:21:50 -0000	1.80
+++ fs/jffs2/write.c	8 Feb 2004 11:29:14 -0000
@@ -97,6 +97,12 @@ struct jffs2_full_dnode *jffs2_write_dno
 	int retried = 0;
 	unsigned long cnt = 2;
 
+	if (data && datalen && 
+	    (je32_to_cpu(ri->data_crc) != crc32(0, data, datalen))) {
+		    printk(KERN_CRIT "Eep. Data CRC not correct in jffs2_write_dnode()\n");
+		    BUG();
+	}
+
 	D1(if(je32_to_cpu(ri->hdr_crc) != crc32(0, ri, sizeof(struct jffs2_unknown_node)-4)) {
 		printk(KERN_CRIT "Eep. CRC not correct in jffs2_write_dnode()\n");
 		BUG();

-- 
dwmw2





More information about the linux-mtd mailing list