Skip to content
Commit 972228d8 authored by Richard Weinberger's avatar Richard Weinberger
Browse files

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: default avatarJörg Pfähler <pfaehler@isse.de>
Reviewed-by: default avatarJörg Pfähler <pfaehler@isse.de>
Signed-off-by: default avatarRichard Weinberger <richard@nod.at>
parent c0a1ecb9
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment