UBI: Fastmap: Rework fastmap error paths
authorRichard Weinberger <richard@nod.at>
Mon, 10 Nov 2014 15:11:40 +0000 (16:11 +0100)
committerRichard Weinberger <richard@nod.at>
Thu, 26 Mar 2015 21:46:03 +0000 (22:46 +0100)
commit5ca97ad83800938e8aeea622821a26d69d2052bf
tree91c62e747bd2dfd33dbed9bba7faa89c1b38b91d
parent61de74ce2fa2cc9eee85cf5edc6525b12831b507
UBI: Fastmap: Rework fastmap error paths

If UBI is unable to write the fastmap to the device
we have make sure that upon next attach UBI will fall
back to scanning mode.
In case we cannot ensure that they only thing we can do
is falling back to read-only mode.

The current error handling code is not powercut proof.
It could happen that a powercut while invalidating would
lead to a state where an too old fastmap could be used upon
attach.
This patch addresses the issue by writing a fake fastmap
super block to a fresh PEB instead of reerasing the existing one.
The fake fastmap super block will UBI case to do a full scan.

Signed-off-by: Richard Weinberger <richard@nod.at>
drivers/mtd/ubi/fastmap.c