ubi: Make volume resize power cut aware
authorRichard Weinberger <richard@nod.at>
Thu, 23 Jun 2016 17:30:38 +0000 (19:30 +0200)
committerRichard Weinberger <richard@nod.at>
Fri, 29 Jul 2016 21:32:01 +0000 (23:32 +0200)
commit4946784bd3924b1374f05eebff2fd68660bae866
tree309fe1d3d97aeabbc6df3b8b40b89b3be20f839d
parentbc743f34dfa011e62edd0ea4ae8455be06c083b5
ubi: Make volume resize power cut aware

When the volume resize operation shrinks a volume,
LEBs will be unmapped. Since unmapping will not erase these
LEBs immediately we have to wait for that operation to finish.
Otherwise in case of a power cut right after writing the new
volume table the UBI attach process can find more LEBs than the
volume table knows. This will render the UBI image unattachable.

Fix this issue by waiting for erase to complete and write the new
volume table afterward.

Cc: <stable@vger.kernel.org>
Reported-by: Boris Brezillon <boris.brezillon@free-electrons.com>
Reviewed-by: Boris Brezillon <boris.brezillon@free-electrons.com>
Signed-off-by: Richard Weinberger <richard@nod.at>
drivers/mtd/ubi/vmt.c