]> git.baikalelectronics.ru Git - kernel.git/commit
ubi: Make recover_peb power cut aware
authorRichard Weinberger <richard@nod.at>
Mon, 20 Jun 2016 22:31:50 +0000 (00:31 +0200)
committerRichard Weinberger <richard@nod.at>
Wed, 22 Jun 2016 22:29:32 +0000 (00:29 +0200)
commit67e28c567eba11a41ab72105de78727ed83518cf
tree41cf6d89bcc2899d00d52b46d4333179f4903e50
parent46d5db044e26da857604cce0ca178b9b747b7da4
ubi: Make recover_peb power cut aware

recover_peb() was never power cut aware,
if a power cut happened right after writing the VID header
upon next attach UBI would blindly use the new partial written
PEB and all data from the old PEB is lost.

In order to make recover_peb() power cut aware, write the new
VID with a proper crc and copy_flag set such that the UBI attach
process will detect whether the new PEB is completely written
or not.
We cannot directly use ubi_eba_atomic_leb_change() since we'd
have to unlock the LEB which is facing a write error.

Cc: stable@vger.kernel.org
Reported-by: Jörg Pfähler <pfaehler@isse.de>
Reviewed-by: Jörg Pfähler <pfaehler@isse.de>
Signed-off-by: Richard Weinberger <richard@nod.at>
drivers/mtd/ubi/eba.c