This is the mail archive of the
ecos-discuss@sources.redhat.com
mailing list for the eCos project.
jffs2 BUG:s in jffs2_garbage_collect_dnode
- From: "Per Hedblom" <per dot hedblom at abem dot se>
- To: <ecos-discuss at sources dot redhat dot com>
- Date: Wed, 20 Oct 2004 17:49:03 +0200
- Subject: [ECOS] jffs2 BUG:s in jffs2_garbage_collect_dnode
I have found that jffs2 fails to garbage collect the inode that it currently
adds data to.
The result is that jffs2_garbage_collect_dnode ends with a BUG() call.
I have created a test case that I run on the ecos synt target.
My test stresses the jffs2 with a near to full file system.
I add files until I get ENOSPC and the remove an old file to make space for
a new one.
Here is how it goes:
----------------------------
User level code:
Open file /small_files/127 for append (inode #186)
Write 12000 bytes to file /small_files/127
JFFS2:
jffs2_gc_fetch_inode #169 link=1
jffs2_gc_fetch_inode #167 link=1
jffs2_gc_fetch_inode #166 link=1
jffs2_gc_fetch_inode #172 link=1
jffs2_gc_fetch_inode #172 link=1
jffs2_gc_fetch_inode #178 link=1
jffs2_gc_fetch_inode #173 link=1
jffs2_write_inode_range:increasing writtenlen by 204 #186
jffs2_write_inode_range:increasing writtenlen by 84 #186
jffs2_gc_fetch_inode #186 link=1
BUG() at /home/perhedblom/redhat/ecos/packages/fs/jffs2/current/src/gc.c
1161
----------------------------
The test that fails is BUG_ON(end > JFFS2_F_I_SIZE(f)) in the function
jffs2_garbage_collect_dnode in gc.c.
The problem is that the 288(=204+84) bytes latest written are not added to
the inode->i_size yet but already available in the frag tree.
I guess that this problem is only related to ecos/jffs2.
I can add code to modify the inode->i_size in the jffs2_write_inode_range
after each successful written but I don't think this is correct to the jffs2
architecture and I need to restore the i_size if write fails later and
needs to return an error code.
I can remove the BUG test in gc.c
I suppose it is correct of jffs2 to garbage collect the node that is
currently added to.
Comments? Solutions?
--
Per Hedblom
--
Before posting, please read the FAQ: http://ecos.sourceware.org/fom/ecos
and search the list archive: http://ecos.sourceware.org/ml/ecos-discuss