UBI: recover_peb and power cut safety

Jörg Pfähler pfaehler at isse.de
Mon Jun 20 06:48:22 PDT 2016


Hi Richard,

> Hmm, you are right, if ubi_eba_write() is facing -EIO from the MTD driver we
> can lose the whole erase block upon power cut.
> So you found a bug. :-)
>
> Artem, can you tell more on this?
> I'd guess that recover_peb() is older than ubi_eba_atomic_leb_change() and
> therefore it was not used.
> And nobody noticed so far since the condition is hard to hit.
> 
> That said, switching to ubi_eba_atomic_leb_change() seems like a good
> plan to me.
> Jörg, please send a patch and explain how you tested it.

First of all, thanks for confirming this bug so quickly.

However, we would like to refrain from providing a patch. A little inspection 
of the code revealed that the locking is different for both methods, i.e., one 
cannot just call ubi_eba_atomic_leb_change. So it would be a larger change to 
the code than we thought. Furthermore, we have no experience in writing or 
debugging code for the linux kernel and we own only one flash chip for 
testing, so we would not feel very confident in any patch we could provide.

We found the bug rather in the formal verification of a model of UBI/UBIFS 
(see http://www.isse.de/flashix for more details on our project), where it 
turned out that we modeled the feature differently.

MfG,
Jörg

--------------------------------------------------------------------------------------
Jörg Pfähler
Lehrstuhl für Softwaretechnik
Institut für Software and Systems Engineering
Universität Augsburg

Universitätsstr. 6a, Raum 3014
tel:      (+49) 821/598-2229
e-mail:   pfaehler at isse.de<mailto:pfaehler at isse.de>
--------------------------------------------------------------------------------------



More information about the linux-mtd mailing list