[U-Boot] [PATCH] UBI: fix endless loop when a bitflip was detected

Wolfgang Denk wd at denx.de
Thu Oct 6 23:32:24 CEST 2011


Dear Holger Brunck,

In message <1315904833-11430-1-git-send-email-holger.brunck at keymile.com> you wrote:
> On km_kirkwood boards we saw that u-boot gets stuck if the
> UBI layer detects a correctable bitflip in the NAND flash
> when u-boot tries to attach to the UBI device.
> 
> This was already fixed in the UBI layer in the current
> mainline linux. The original commit was:
> 
> "commit b86a2c56e512f46d140a4bcb4e35e8a7d4a99a4b
> Author: Artem Bityutskiy <Artem.Bityutskiy at nokia.com>
> Date:   Sun May 24 14:13:34 2009 +0300
> 
> UBI: do not switch to R/O mode on read errors
> 
> This patch improves UBI errors handling. ATM UBI switches to
> R/O mode when the WL worker fails to read the source PEB.
> This means that the upper layers (e.g., UBIFS) has no
> chances to unmap the erroneous PEB and fix the error.
> This patch changes this behaviour and makes UBI put PEBs
> like this into a separate RB-tree, thus preventing the
> WL worker from hitting the same read errors again and
> again.
> 
> But there is a 10% limit on a maximum amount of PEBs like this.
> If there are too much of them, UBI switches to R/O mode.
> 
> Additionally, this patch teaches UBI not to panic and
> switch to R/O mode if after a PEB has been copied, the
> target LEB cannot be read back. Instead, now UBI cancels
> the operation and schedules the target PEB for torturing.
> 
> The error paths has been tested by ingecting errors
> into 'ubi_eba_copy_leb()'."
> 
> This patch is the portation to u-boot with some changes. The
> constants for errors used in the original patch were replaced
> with numeric values as present in current ubi layer. The constant
> "MOVE_TARGET_RD_ERR" was removed from the original patch because
> the current u-boot version didn't evaluate this value.
> 
> Signed-off-by: Holger Brunck <holger.brunck at keymile.com>
> cc: Stefan Roese <sr at denx.de>
> ---
>  drivers/mtd/ubi/build.c |    9 +++++++++
>  drivers/mtd/ubi/eba.c   |    8 ++++++--
>  drivers/mtd/ubi/ubi.h   |   10 ++++++++--
>  drivers/mtd/ubi/wl.c    |   43 +++++++++++++++++++++++++++++++++++++------
>  4 files changed, 60 insertions(+), 10 deletions(-)

Checkpatch says:

total: 0 errors, 2 warnings, 166 lines checked

Please clean up and resubmit.  Thanks.

Best regards,

Wolfgang Denk

-- 
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
A modem is a baudy house.


More information about the U-Boot mailing list