This is the mail archive of the
ecos-patches@sources.redhat.com
mailing list for the eCos project.
Re: [ECOS] JFFS2 Garbage Collection Error? (NO! rbtree.c bug)
- From: Scott Wilkinson <scott at alliantnetworks dot com>
- To: David Woodhouse <dwmw2 at infradead dot org>
- Cc: "Gary D. Thomas" <gary at mind dot be>, ecos-discuss at sources dot redhat dot com, ecos-patches at sources dot redhat dot com
- Date: 14 Jul 2003 10:05:12 -0700
- Subject: Re: [ECOS] JFFS2 Garbage Collection Error? (NO! rbtree.c bug)
- Organization:
- References: <1057703623.1151.58.camel@localhost.localdomain> <61921.210.150.186.27.1057704241.squirrel@www.chez-thomas.org> <1058036153.2262.43.camel@imladris.demon.co.uk> <1058050545.8919.13.camel@localhost.localdomain> <1058118955.2262.74.camel@imladris.demon.co.uk>
On Sun, 2003-07-13 at 10:55, David Woodhouse wrote:
> On Sat, 2003-07-12 at 23:55, Scott Wilkinson wrote:
> > If, for testing purposes, I compile eCos using the linux rbtree.[ch]
> > instead of the eCos/OpenBSD port, my JFFS2 stuff works (and very well so
> > far I might add!).
>
> I note the trees dumped before the call to rb_erase() and the crash are
> identical in the Linux and eCos versions -- it doesn't seem to be an
> error in _building_ the tree, only removing stuff from it.
>
> I note further that your test case also works if I take the Linux
> rb_erase() function and drop it into the BSD/eCos rbtree.c, adjusting
> name and order of rb_remove_color() and its arguments respectively.
>
I believe I fixed the bug in the eCos rbtree.c that was causing JFFS2 to
fail during certain garbage collection events. It was a simple problem
of copying pointers to structures instead of copying the entire
structure itself, as is necessary.
I am continuing to test, but the attached patch seems to do the trick!
Scott
Index: rbtree.c
===================================================================
RCS file: /home/cvs/ecos/packages/compat/linux/current/src/rbtree.c,v
retrieving revision 1.1.1.1
diff -u -r1.1.1.1 rbtree.c
--- rbtree.c 14 May 2003 17:47:38 -0000 1.1.1.1
+++ rbtree.c 14 Jul 2003 17:02:29 -0000
@@ -294,7 +294,7 @@
RB_HEAD(head) = child;
if (RB_PARENT(elm) == old)
parent = elm;
- (elm) = (old);
+ *(elm) = *(old);
if (RB_PARENT(old)) {
if (RB_LEFT(RB_PARENT(old)) == old)
RB_LEFT(RB_PARENT(old)) = elm;