jffs2_truncate_fragtree does not handle NULL return from jffs2_lookup_node_frag

Dragan Marinkovic marinkovic.dragan at gmail.com
Wed Nov 22 11:49:08 EST 2006


Thanks Artem, I'll take a look.

"JFFS2 partition is being updated" means that the file has been
written to at the moment of the power loss. What's interesting is that
if I'm writing 1MB file to the JFFS2 partition (which gives me enough
time to reliably pull the plug during write operation) the power loss
is always handled properly: the old version of the file is always
there when the power is back on.

To be more precise, I have trouble with the file size of about 11K
(this really isn't any magic number, basically smaller files). I have
/tmp dir. on tmpfs . I'm moving the file there, doing some
manipulation on it (sed, cat, etc.) and copy the file back to its
original location (JFFS2 fs). If I experience the power loss at the
moment of the file copy operation, the file just vanishes. The same is
true if the file is manipulated directly on the JFFS2 partition. I've
tried 'mv', 'cat' and 'cp' -- all with the same result.

The erase block size on the JFFS2 partition is set to 128K (131072
bytes) . I can post USB stick and kernel config specific details if
needed.

Thanks again,
Dragan

On 11/22/06, Artem Bityutskiy <dedekind at infradead.org> wrote:
> On Tue, 2006-11-21 at 23:35 -0800, Dragan Marinkovic wrote:
> > Digging a bit deeper, I found that jffs2_truncate_fragtree is not
> > handling the NULL as a return value from jffs2_lookup_node_frag . It looks
> > like that NULL return is perfectly legal. The patch to fix this is attached.
> > I'm not really sure if this is the right place to fix this problem but
> > it should be OK from the correctness prospective (can't use NULL
> > pointers).
>
> The NULL is legal, but JFFS2 does handle it. Look at the latest git
> version. Please, point which particular C operation in the
> jffs2_truncate_fragtree() function causes the oops.
>
> > More to it, I've noticed that if I remove the system power while file
> > on JFFS2 partition is being updated (it takes a bit of time to hit the
> > right moment), I'll completely lose the file (it just disappears). Any
> > ideas?
>
> What does "JFFS2 partition is being updated" mean?
>
> --
> Best regards,
> Artem Bityutskiy (Битюцкий Артём)
>
>


More information about the linux-mtd mailing list