OpenCloudOS-Kernel/drivers/mtd/ubi
Artem Bityutskiy 7ac760c2f7 UBI: fix corrupted PEB detection for NOR flash
My new shiny code for corrupted PEB detection has NOR specific bug.
We tread PEB as corrupted and preserve it, if

1. EC header is OK.
2. VID header is corrupted.
3. data area is not "all 0xFFs"

In case of NOR we have 'nor_erase_prepare()' quirk, which invalidates
the headers before erasing the PEB. And we invalidate first the VID
header, and then the EC header. So if a power cut happens after we have
invalidated the VID header, but before we have invalidated the EC
header, we end up with a PEB which satisfies the above 3 conditions,
and the scanning code will treat it as corrupted, and will print
scary warnings, wrongly.

This patch fixes the issue by firt invalidating the EC header, then
invalidating the VID header. In case of power cut inbetween, we still
just lose the EC header, and UBI can deal with this situation gracefully.

Thanks to Anatolij Gustschin <agust@denx.de> for tracking this down.

Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
Reported-by: Anatolij Gustschin <agust@denx.de>
Tested-by: Anatolij Gustschin <agust@denx.de>
2010-12-03 15:49:21 +02:00
..
Kconfig UBI: cleanup and simplify Kconfig 2010-10-19 17:19:55 +03:00
Kconfig.debug UBI: cleanup and simplify Kconfig 2010-10-19 17:19:55 +03:00
Makefile UBI: make gluebi a separate module 2009-06-03 17:45:23 +03:00
build.c UBI: preserve corrupted PEBs 2010-10-19 17:19:57 +03:00
cdev.c llseek: automatically add .llseek fop 2010-10-15 15:53:27 +02:00
debug.c UBI: introduce flash dump helper 2009-08-14 20:02:20 +03:00
debug.h UBI: introduce debugging helper function 2010-10-19 17:19:57 +03:00
eba.c UBI: preserve corrupted PEBs 2010-10-19 17:19:57 +03:00
gluebi.c include cleanup: Update gfp.h and slab.h includes to prepare for breaking implicit slab.h inclusion from percpu.h 2010-03-30 22:02:32 +09:00
io.c UBI: fix corrupted PEB detection for NOR flash 2010-12-03 15:49:21 +02:00
kapi.c UBI: fix s/then/than/ typos 2010-05-07 08:33:10 +03:00
misc.c UBI: make check_pattern function non-static 2010-10-19 17:19:57 +03:00
scan.c UBI: fix corrupted PEB detection for NOR flash 2010-12-03 15:49:21 +02:00
scan.h UBI: remember copy_flag while scanning 2010-10-21 11:20:36 +03:00
ubi-media.h UBI: add image sequence number to EC header 2009-07-05 18:47:07 +03:00
ubi.h UBI: preserve corrupted PEBs 2010-10-19 17:19:57 +03:00
upd.c UBI: fix memory leak in update path 2010-01-18 18:53:56 +02:00
vmt.c UBI: preserve corrupted PEBs 2010-10-19 17:19:57 +03:00
vtbl.c UBI: preserve corrupted PEBs 2010-10-19 17:19:57 +03:00
wl.c UBI: preserve corrupted PEBs 2010-10-19 17:19:57 +03:00