]> git.baikalelectronics.ru Git - kernel.git/commit
UBI: fix corrupted PEB detection for NOR flash
authorArtem Bityutskiy <Artem.Bityutskiy@nokia.com>
Thu, 2 Dec 2010 04:34:01 +0000 (06:34 +0200)
committerArtem Bityutskiy <Artem.Bityutskiy@nokia.com>
Fri, 3 Dec 2010 13:49:21 +0000 (15:49 +0200)
commit278e197ec8154842862f9a5b32229f351d5cb053
tree424592684b1e91ba7189195b0c89abd2f68b515b
parentb003b636e9ae6832a60fe9625655bbd9fe40feac
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>
drivers/mtd/ubi/io.c
drivers/mtd/ubi/scan.c