JFFS2 corruption when mounting filesystem with filenamesoflength> 7

Steve Deiters SteveDeiters at BASLER.com
Mon Jun 28 17:25:02 EDT 2010


> I think there may be something weird going on with the memcpy 
> in my build.  If I use the following patch I no longer get 
> errors when I mount the filesystem.  All I did was replace 
> the memcpy with a loop.
> 
> I'm not sure what's special about this particular use of 
> memcpy.  I can't believe that things would be working as well 
> as they do if memcpy was broken in general.
> 
> This is on a PowerPC 32 bit build for a MPC5121.  I am using 
> a GCC 4.1.2 to compile.  Is anyone aware of any issues with 
> memcpy in this configuration?
> 
> Thanks.

It seems this processor is mangling the data when it access unaligned
addresses into Flash with a lwz instruction.  The memcpy implementation
in copy_32.S aligns the destination, leaving the source possibly
unaligned.  In this particular instance the source is an address into my
Flash address space which is causing the problem.  When the filenames
were < 8 it always does a bytewise copy which is why I wasn't having
problems with those.

It seems this only occurs when I have the translation enabled.  If I
clear the DR bit in the MSR and then repeat the instruction with the
corresponding physical address it will read correctly.

I'm not sure if this is expected behavior with this core.  I can fix at
least this one problem by using memcpy_fromio since it does alignment
checks for the source and destination.

I'm not sure what the proper fix is for this.  If I use memcpy_fromio I
think I'll just run into problems somewhere else.  Any other
suggestions?

Thanks.



More information about the linux-mtd mailing list