[ECOS] Re: FTP runs out of JFFS2 nodes and trashes the file system

Jürgen Lambrecht jurgen.lambrecht2@telenet.be
Mon Apr 7 23:22:00 GMT 2008


I have the problem that I cannot FTP more than 200 files at once to my 
board. It always fails with this message:

  arena=301672, uordblks=30728, fordblks=270924, maxfree=261196.
  arena=301672, uordblks=41160, fordblks=260492, maxfree=260188.
  arena=301672, uordblks=44808, fordblks=256844, maxfree=252148.
  arena=301672, uordblks=46000, fordblks=255652, maxfree=252148.
  arena=301672, uordblks=49176, fordblks=252476, maxfree=240948.
  Unable to allocate raw_node_ref
  Unable to allocate raw_node_ref
  Unable to allocate raw_node_ref
  arena=301672, uordblks=47552, fordblks=254100, maxfree=245340.

- My raw node data structures (jffs2_raw_node_ref) are of course 
statically allocated - CYGNUM_FS_JFFS2_RAW_NODE_REF_CACHE_POOL_SIZE is 
set to 16000. (This needs 250kB; the user can use 55MB, so with 4kB 
nodes, I have 1920 free nodes for smaller nodes at the end of a file.)
  Compression is disabled (as I mainly store mp3 files). I put the 

- In jffs2/../malloc-ecos.c I added a counter as you can see in the log 
  In this test, after FTP'ing 189 files with in total 3706kB, the file 
system crashes, but in a "valid" way: indeed, as the counter proofs, the 
raw node pool is empty, *but how is this possible?*
Therefore my question about FTP in 
  I have to unmount/mount or reboot to be able to delete files again. If 
I then don't delete but add files instead, it fails with the same error 
after a few files. When I repeat this cycle of reboot-add files a few 
times (depending on previous state of the file system) *jffs2 
"crashes"*: I cannot anymore delete or add any file - listing 
directories still works, also the application still runs.
I have to format the flash to solve the problem.

- When I do the same test with TFTP, I can put over 1000 files in 1 
directory (and then TFTP times out because jffs2 becomes too slow with 
so many files in the directory).
Mark: the test is reproducible, independent of the SW and HW.

- I use now the flash-v2 driver to avoid problems with the main cvs tree 
non-interrupt save driver.
  But I read this in the documentation: "However the library may not be 
interrupt safe. An interrupt must not cause execution of code that is 
resident in FLASH." If I understand it well, *this means the library is 
thread safe on the condition that all code is always executed in RAM?*
This is ok in my case.

- Our ftp server code is based on the Minimal FTP server from Matthias 
Wandel. After a TCP connect, we just have a loop that calls: 
recv(socket,buf,...); fwrite(buf,...);.
I use FTP client in Total Commander.

- My board has a 32MHz AT91M55800A ARM7TDMI processor, with external 1MB 
SRAM and 64MB flash of which 61MB is in a jffs2 partition. Please don't 
remind me that my amount of SRAM is not enough ;-). But as you can see 
in the log, I still have enough heap.

- Maybe this is a *timing issue*, as jffs2 needs more time the more full 
the file system gets?

Kind regards,

Before posting, please read the FAQ: http://ecos.sourceware.org/fom/ecos
and search the list archive: http://ecos.sourceware.org/ml/ecos-discuss

More information about the Ecos-discuss mailing list