Andrew Lunn
2005-02-25 16:46:43 UTC
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));
jffs2_mark_node_obsolete(c, this->node->raw);
jffs2_free_full_dnode(this->node);
} else {
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. Just
removing this bit of code does not seem to correctly fix the
problem. One of the other eCos test cases then fails....
So could somebody point me in the right direction for fixing this.
Thanks
Andrew
To unsubscribe from this list: send the line "unsubscribe jffs-dev" in
the body of a message to ***@axis.com
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));
jffs2_mark_node_obsolete(c, this->node->raw);
jffs2_free_full_dnode(this->node);
} else {
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. Just
removing this bit of code does not seem to correctly fix the
problem. One of the other eCos test cases then fails....
So could somebody point me in the right direction for fixing this.
Thanks
Andrew
To unsubscribe from this list: send the line "unsubscribe jffs-dev" in
the body of a message to ***@axis.com