Skip to contentSkip to conversation

jffs2_do_reserve_space

DISCUSSION Mike Schumi 2 participants 3 messages Jul 25, 2002 Memory technology devices (MTD)

lore
Share & tools
lore
#0 lore raw

David,

(not ftp avail, sorry) I'll email you the dump for the 2 consecutive boots (If anyone else wants them let me know). Everytime I run the cardmgr and plug in the card, the next boot crashes on a write. And every boot after that too. I can bypass this problem by making /var a ramfs mount. (because cardmgr is writing to /var something). So it looks like write to a jffs2 /var is whats causing the problem, because when /var is mounted a ramfs and jffs2 is readonly, all is well. But solving this problem would be nice:) Your help is appreciated...

Sequence on commands I ran:
<boot>
cat /proc/kmsg
echo 9 > /proc/sys/kernel/printk
df
cardmgr
<Plugged in the ATA CF card >
df
<Reboot>
cat /proc/kmsg
echo 9 > /proc/sys/kernel/printk
df
ls > text (<- crash)

----- Original Message -----
From: David Woodhouse <[email protected]>
Date: Thu, 25 Jul 2002 07:40:39 +0100
To: "Mike Schumi" <[email protected]>
Subject: Re: jffs2_do_reserve_space

Quoted 17 lines
Quoted 2 lines · [email protected] said:

I've looked for a solution to this problem, but haven't seen it
posted anywhere, although some ppl have had it before.

Please could you provide a complete debug log, from mount onwards. I need to see how the data structure got into that state. It'll be large -- maybe bzip2 it and tick it up for FTP somewhere?

Also do 'df' as soon as it's happened.

--
dwmw2

Signature · 6 lines
__________________________________________________________
Sign-up for your own FREE Personalized E-mail at Mail.com
http://www.mail.com/?sr=signup

Get 4 DVDs for $.49 cents! plus shipping & processing. Click to join. 
http://oas-central.realmedia.com/RealMedia/ads/click_lx.ads/mail.com/columbiahouse/1112745096/x09/ExactAdv/ColumbiaHouse_IO473_7.19_8.19/blank.gif/636632633232383133383736634333430
#1 lore raw

Can you try this?

Index: fs/jffs2/scan.c
===================================================================
RCS file: /home/cvs/mtd/fs/jffs2/scan.c,v
retrieving revision 1.78

jffs2/scan.c +10 -0
diff -u -p -r1.78 scan.c
@@ -322,6 +322,16 @@ static int jffs2_scan_eraseblock (struct
 			continue;
 		}
 
+		if (ofs + node.totlen > jeb->offset + c->sector_size) {
+			/* Eep. Node goes over the end of the erase block. */
+			printk(KERN_WARNING "Node at 0x%08x with length 0x%08x would run over the end of the erase block\n",
+			       ofs, node.totlen);
+			printk(KERN_WARNING "Perhaps the file system was created with the wrong erase size?");
+			DIRTY_SPACE(4);
+			ofs += 4;
+			continue;
+		}
+
 		if (!(node.nodetype & JFFS2_NODE_ACCURATE)) {
 			/* Wheee. This is an obsoleted node */
 			D2(printk(KERN_DEBUG "Node at 0x%08x is obsolete. Skipping\n", ofs));

--
dwmw2

#2 lore raw
Quoted 1 line · [email protected] said:

Can you try this?

Or this version if you're using the stable branch...

As I said in private mail, I suspect you've written your jffs2 image to the flash 0x40 bytes out of place, and the printk in this sanity check isn't actually correct for you, although it will be for most people who trigger it.

Index: scan.c
===================================================================
RCS file: /home/cvs/mtd/fs/jffs2/scan.c,v
retrieving revision 1.51.2.2

scan.c +10 -0
diff -u -p -r1.51.2.2 scan.c
@@ -261,6 +261,16 @@ static int jffs2_scan_eraseblock (struct
 			continue;
 		}
 
+		if (ofs + node.totlen > jeb->offset + c->sector_size) {
+			/* Eep. Node goes over the end of the erase block. */
+			printk(KERN_WARNING "Node at 0x%08x with length 0x%08x would run over the end of the erase block\n",
+			       ofs, node.totlen);
+			printk(KERN_WARNING "Perhaps the file system was created with the wrong erase size?");
+			DIRTY_SPACE(4);
+			ofs += 4;
+			continue;
+		}
+
 		switch(node.nodetype | JFFS2_NODE_ACCURATE) {
 		case JFFS2_NODETYPE_INODE:
 			err = jffs2_scan_inode_node(c, jeb, &ofs);

--
dwmw2