ubi: fastmap: Correctly handle interrupted erasures in EBA
authorRichard Weinberger <richard@nod.at>
Mon, 28 May 2018 20:04:32 +0000 (22:04 +0200)
committerRichard Weinberger <richard@nod.at>
Thu, 7 Jun 2018 13:53:16 +0000 (15:53 +0200)
commit781932375ffc6411713ee0926ccae8596ed0261c
tree0aa1e9d6fb8f6bdf102d08346f5f2a99b06c997d
parent6e7d80161066c99d12580d1b985cb1408bb58cf1
ubi: fastmap: Correctly handle interrupted erasures in EBA

Fastmap cannot track the LEB unmap operation, therefore it can
happen that after an interrupted erasure the mapping still looks
good from Fastmap's point of view, while reading from the PEB will
cause an ECC error and confuses the upper layer.

Instead of teaching users of UBI how to deal with that, we read back
the VID header and check for errors. If the PEB is empty or shows ECC
errors we fixup the mapping and schedule the PEB for erasure.

Fixes: dbb7d2a88d2a ("UBI: Add fastmap core")
Cc: <stable@vger.kernel.org>
Reported-by: martin bayern <Martinbayern@outlook.com>
Signed-off-by: Richard Weinberger <richard@nod.at>
drivers/mtd/ubi/eba.c