UBIFS Corrupt during power failure

Artem Bityutskiy dedekind at infradead.org
Mon Jul 6 00:51:53 EDT 2009


On Mon, 2009-07-06 at 07:30 +0300, Artem Bityutskiy wrote:
> On Fri, 2009-07-03 at 17:58 +0300, Artem Bityutskiy wrote:
> > On Fri, 2009-07-03 at 08:47 -0600, Urs Muff wrote:
> > > I can't find the data-sheet reference to that, but I would not characterize it as 'erasing from the end'.
> > > 
> > > As far as I understand it is a 2 phase process, and you can lose power at any point so you can see a partial phase I or a partial phase II state.
> > > - phase I: set all data to 00: a partial picture would be to see 00 at the beginning and random at the end of the block
> > > - phase II: set all data to FF: a partial picture would be to see FF at the beginning and 00 at the end of the block
> > 
> > That would be nice, because then UBI would work fine, since it would
> > notice corrupted EC header at the beginning, and would drop the PEB.
> > 
> > > From looking at your dumps, it appears that you got interrupted during
> > > phase II.  I'm not sure why you still have the header, but that might
> > > be b/c the block has been reclaimed / reinitialized (I'm not familiar
> > > with the actual code, but it appears that way from the dump).
> > 
> > No, I believe it was not reinitialized.
> > 
> > But I should write a small test program which writes a known pattern to
> > PEBs, then erases them, and sees what happened to them after an unclean
> > reboot.
> 
> [CCed Nicolas Pitre]
> 
> OK, I've written a small user-space program which first fills the NOR
> flash with an '0x89ABCDEF' pattern, then starts erasing it, and then
> I cut the power at random point.
> 
> And unfortunately the power cut results in eraseblocks which have
> 0x89ABCDEF at the beginning, and all zeroes at the end. I've attached
> one example.
> 
> So it indeed looks like NOR erasure includes writing zeroes from the
> end. Unfortunately UBI/UBIFS cannot handle this correctly ATM.

Although I can easily fix this by writing few zeroes at the beginning of
the eraseblock _before) erasing it, so that UBI will be happy. But it is
still interesting whether I may just ask NOR to amend it's embedded
erase algorithm.

-- 
Best regards,
Artem Bityutskiy (Битюцкий Артём)




More information about the linux-mtd mailing list