ubifs_scan() error handling

Artem Bityutskiy dedekind1 at gmail.com
Tue Jul 13 00:28:09 EDT 2010


On Wed, 2010-06-23 at 13:04 -0400, twebb wrote:
> Without having a complete understanding of how the UBI and UBIFS
> internals work, I have a question regarding error handling in
> ubifs_scan().
> 
> When ubifs_scan() encounters SCANNED_EMPTY_SPACE during execution, it
> checks whether the LEB is all 0xFFs and if not - returns -EUCLEAN.

Yes, because it UBIFS always writes to LEBs from the beginning to the
end, node by node. Then, when power cut happens, it should have
something like

LEB: | good nodes | a broken node | 0xFFs |

this is what it checks. If it does not see 0xFFs, this is some unknow
situation for UBIFS and it prefers to refuse the flash.

In MLC case, you may have bit-flips. So you need to teach UBIFS to
accept 0xFFs + bitflips.

>   In
> some cases (for example, in orphan.c/kill_orphans()), any error
> returned by ubifs_scan() results in a call to ubifs_recover_leb().

I need to look closer, but looks like we just forgot to check the
need_recovery flag.

> Would it make sense and be acceptable to make this call any time
> ubifs_scan() returns an error? 

May be. I'll think and return to you.

>  And if so, would it make more sense to
> include the ubifs_recover_leb() call in ubifs_scan() at goto
> corruption?

Also need to think.

-- 
Best Regards,
Artem Bityutskiy (Артём Битюцкий)




More information about the linux-mtd mailing list