Creech, Matthew | 2 Feb 16:00
Favicon

JFFS2 on dataflash problem

Hi,

Please forgive the cross-posting, but I'm not sure where exactly to go
with this problem.

I have an embedded device based on Atmel's AT91RM9200DK board, which is
using serial dataflash (AT45DB642).  I've allocated a JFFS2 partition to
store non-volatile data.  In testing I stumbled across a particular
problem that only occurs after heavy hammering on our device, but is
fairly consistent in how and when it occurs.  The pattern has been
narrowed down so that a script doing something like this:

while [ 1 ]; do
   cp /mnt/jffs2/$RANDOM_FILE /mnt/jffs2/$BLAH
   # File size has been tested between 8K and 64K
done

makes the problem occur within 24 to 36 hours.  So something about
copying one file over another one breaks things.  The "problem" here is
that every I/O operation having to do with the JFFS2 partition blocks
indefinitely.  For example, after running the test for 2 days, you can
log into the device and try to "ls" the contents of /mnt/jffs2, and your
shell will hang.  You can then login on another terminal, but you'll get
another hang if you try to have any interaction with the JFFS2
partition.  So everything else seems to function normally, but JFFS2
just dies.  Also note that rebooting the device sometimes fixes things
right up (JFFS2 mounts fine and works properly as if nothing happened at
all), but sometimes the filesystem image is corrupt and refuses to
mount.

(Continue reading)

Ulf Samuelsson | 2 Feb 22:32
Favicon

Re: JFFS2 on dataflash problem

> I have an embedded device based on Atmel's AT91RM9200DK board, which is
> using serial dataflash (AT45DB642).  I've allocated a JFFS2 partition to
> store non-volatile data.  In testing I stumbled across a particular
> problem that only occurs after heavy hammering on our device, but is
> fairly consistent in how and when it occurs.  The pattern has been
> narrowed down so that a script doing something like this:

> while [ 1 ]; do
>   cp /mnt/jffs2/$RANDOM_FILE /mnt/jffs2/$BLAH
>   # File size has been tested between 8K and 64K
> done

If I wrote this script I would call it:

wear_out_dataflash_quickly.sh

There are some limitations to the number of erase cycles in the dataflash.
(IN any flash to be correct)
You can expect to reprogram it 50,000-100.000 times before the first errors
occur.
The second thing is that you need to do a block erase after the sum
of erases inside an 8 page block exceeds 10,000.

I am not at all sure that the MTD drivers/JFFS2 handle this (did not look at
the code).
I assume that JFFS may be able to detect a bad write and map
the block out from time to time, so this could explain why you can do the
recover.

If you really want to test the dataflash, write a CRC in the extra bytes
(Continue reading)

Adrian Bunk | 16 Feb 10:59
Picon
Favicon

[2.6 patch] fs/jffs/: misc cleanups

This patch contains the following cleanups:
- make some needlessly global code static
- #if 0 the following unused functions:
  - intrep.c: jffs_print_file
  - jffs_fm.c: jffs_print_node_ref

Signed-off-by: Adrian Bunk <bunk <at> stusta.de>

---

This patch was already sent on:
- 8 Jan 2005
- 24 Jan 2005

 fs/jffs/inode-v23.c  |   10 +++----
 fs/jffs/intrep.c     |   60 ++++++++++++++++++++++++++++++-------------
 fs/jffs/intrep.h     |   32 +---------------------
 fs/jffs/jffs_fm.c    |   12 ++++++--
 fs/jffs/jffs_fm.h    |    6 +---
 include/linux/jffs.h |    1 
 6 files changed, 61 insertions(+), 60 deletions(-)

--- linux-2.6.10-mm2-full/fs/jffs/inode-v23.c.old	2005-01-08 04:00:49.000000000 +0100
+++ linux-2.6.10-mm2-full/fs/jffs/inode-v23.c	2005-01-08 04:01:36.000000000 +0100
@@ -334,7 +334,7 @@
 } /* jffs_notify_change()  */

 
-struct inode *
+static struct inode *
(Continue reading)

Adrian Bunk | 16 Feb 10:59
Picon
Favicon

[2.6 patch] fs/jffs2/: misc cleanups

This patch contains the following cleanups:
- make some needlessly global functions static
- remove the following unused global functions:
  - compr.c: jffs2_set_compression_mode
  - compr.c: jffs2_get_compression_mode

Signed-off-by: Adrian Bunk <bunk <at> stusta.de>

---

This patch was already sent on:
- 8 Jan 2005
- 24 Jan 2005

 fs/jffs2/compr.c       |   10 ----------
 fs/jffs2/compr.h       |    3 ---
 fs/jffs2/compr_rtime.c |   12 ++++++++----
 fs/jffs2/erase.c       |    3 ++-
 fs/jffs2/file.c        |   15 +++++++++++----
 fs/jffs2/fs.c          |    3 ++-
 fs/jffs2/nodelist.h    |    1 -
 fs/jffs2/os-linux.h    |    5 -----
 fs/jffs2/wbuf.c        |    2 +-
 9 files changed, 24 insertions(+), 30 deletions(-)

--- linux-2.6.10-mm2-full/fs/jffs2/compr.h.old	2005-01-08 04:16:42.000000000 +0100
+++ linux-2.6.10-mm2-full/fs/jffs2/compr.h	2005-01-08 04:18:40.000000000 +0100
@@ -41,9 +41,6 @@
 #define JFFS2_COMPR_MODE_PRIORITY   1
 #define JFFS2_COMPR_MODE_SIZE       2
(Continue reading)

Muhammad Yahya | 24 Feb 00:13
Picon

Errors writing to flash

Hi,

I am running a PPC 875 board with Linux  2.4.25 and an 8MB flash.
When I try to write to the flash an image, as

>
> /tmp # wget -O - 
> http://129.148.183.102/~muhammad/flashupdate/spimage_nouboot |
> dd of=/dev/mtdblock0 bs=1k seek=256
> 7936+0 records in
> 7936+0 records out
>
> The write seems to go OK withiout any errors, but, on the console, we see
> the following messages which I an not sure if they are coming from 
> jffs or the mtd driver.
> Sometimes these messages are output right away after the write 
> completes and
> sometimes there is a delay before they are output:
>
>
> Node totlen on flash (0xffffffff) != totlen in node ref (0x000000c0)
> Node totlen on flash (0xffffffff) != totlen in node ref (0x00000064)
> Node totlen on flash (0xffffffff) != totlen in node ref (0x00000044)
>
> Any idea as to what this means and how to avoid this ? 

Thanks!
Muhammad

>
(Continue reading)

Andrew Lunn | 25 Feb 17:46
Picon
Gravatar

Possible bug in file truncation code

Hi Folks

Im tracking down a bug reported on the eCos mailing list. Please see
the thread:

http://ecos.sourceware.org/ml/ecos-discuss/2005-02/msg00319.html

In summary, the following causes the filesystem to be corrupted:

        fd = fopen("foobar", "w");
        fclose(fd);

ie openning a file so that it gets truncated and then closing
it. There ie an eCos test case in the thread.

I've looked at the code. The achive the truncation eCos does:

jffs2_truncate_fraglist(c, &f->fragtree, 0);

this in turn does

jffs2_obsolete_node_frag(c, frag);

for every fragment the node has. jffs2_obsolete_node_frag() has this
bit of code:

      if (!this->node->frags) {
		/* The node has no valid frags left. It's totally obsoleted */
		D2(printk(KERN_DEBUG "Marking old node @0x%08x (0x%04x-0x%04x) obsolete\n",
			  ref_offset(this->node->raw), this->node->ofs, this->node->ofs+this->node->size));
(Continue reading)

David Woodhouse | 25 Feb 18:21
Favicon

Re: Possible bug in file truncation code

On Fri, 2005-02-25 at 17:46 +0100, Andrew Lunn wrote:
>ie if the node does not have any fragments left its marked as
>obsolete. These appears to remove the node, but still leaves it
>referenced in the directory. Hence the filesystem is corrupt.

Directories don't refer to data nodes. They refer to inodes. This inode
still exists and is zero-length because it has no valid data nodes. The
directory still refers to it -- that's fine. What's the actual problem?

--

-- 
dwmw2

To unsubscribe from this list: send the line "unsubscribe jffs-dev" in
the body of a message to majordomo <at> axis.com

Andrew Lunn | 25 Feb 18:43
Picon
Gravatar

Re: Possible bug in file truncation code

On Fri, Feb 25, 2005 at 05:21:41PM +0000, David Woodhouse wrote:
> On Fri, 2005-02-25 at 17:46 +0100, Andrew Lunn wrote:
> >ie if the node does not have any fragments left its marked as
> >obsolete. These appears to remove the node, but still leaves it
> >referenced in the directory. Hence the filesystem is corrupt.
> 
> Directories don't refer to data nodes. They refer to inodes. This inode
> still exists and is zero-length because it has no valid data nodes. The
> directory still refers to it -- that's fine. What's the actual problem?

The test case does the open, followed by a close then umount and then
mounts. The mount then reports:

<5>Eep. Child "TestFile.txt" (ino #10) of dir ino #1 doesn't exist!

I've attached the test case if you want to try it.

        Andrew
Attachment (jffs2_4.c): text/x-csrc, 1186 bytes
David Woodhouse | 25 Feb 18:59
Favicon

Re: Possible bug in file truncation code

On Fri, 2005-02-25 at 18:43 +0100, Andrew Lunn wrote:
>
>The test case does the open, followed by a close then umount and then
>mounts. The mount then reports:
>
><5>Eep. Child "TestFile.txt" (ino #10) of dir ino #1 doesn't exist!

The inode #10 has no nodes at all, but it should have been left with one
-- a metadata node, which contains uid, gid, size, etc. information but
no data payload. This should have been written before calling
jffs2_truncate_fraglist(). 

Remember that the actual obsoletion of nodes on the medium is just an
optimisation, and it may not happen with NAND or other types of flash. 

Any truncation (to zero, or to any other length) should first write a
new node with the appropriate i_size, before calling
jffs2_truncate_fraglist().

If you support truncate-to-longer (Linux generally does but POSIX
doesn't require it) then your new metadata node should also have a data
payload make sure the space between the old EOF and the new EOF is
filled with zeroes and prevent old data from before a previous
truncation from 'showing through' where the file is now extended. Zeroes
compress quite easily with JFFS2_COMPR_ZERO -- there's no actual payload
on the medium at all.

See jffs2_do_setattr() in fs.c for the Linux version -- in Linux, that
function also handles changes to i_size.

(Continue reading)

Andrew Lunn | 25 Feb 21:28
Picon
Gravatar

Re: Possible bug in file truncation code

> Any truncation (to zero, or to any other length) should first write a
> new node with the appropriate i_size, before calling
> jffs2_truncate_fraglist().

Thanks David, that was what was wrong. The eCos code just set the
inode->isize to zero and did not create any new node.

I just committed the patch to eCos and mtd.

        Andrew

To unsubscribe from this list: send the line "unsubscribe jffs-dev" in
the body of a message to majordomo <at> axis.com


Gmane