• R
    ubi: Make recover_peb power cut aware · 972228d8
    Richard Weinberger 提交于
    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: NJörg Pfähler <pfaehler@isse.de>
    Reviewed-by: NJörg Pfähler <pfaehler@isse.de>
    Signed-off-by: NRichard Weinberger <richard@nod.at>
    972228d8
eba.c 40.4 KB