OSDN Git Service

ubi: Be more paranoid while seaching for the most recent Fastmap
authorRichard Weinberger <richard@nod.at>
Tue, 14 Jun 2016 08:12:17 +0000 (10:12 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 25 Jul 2018 08:18:32 +0000 (10:18 +0200)
commitfaf2b8d929a47809eab04f17e21f44ebae377dc6
tree1366d421ef8403caeaa6b8c907c6fce1a30bf6f7
parent6fdca47fcc1a26b770ce1eb1a440ea06f8d804c5
ubi: Be more paranoid while seaching for the most recent Fastmap

commit 74f2c6e9a47cf4e508198c8594626cc82906a13d upstream.

Since PEB erasure is asynchornous it can happen that there is
more than one Fastmap on the MTD. This is fine because the attach logic
will pick the Fastmap data structure with the highest sequence number.

On a not so well configured MTD stack spurious ECC errors are common.
Causes can be different, bad hardware, wrong operating modes, etc...
If the most current Fastmap renders bad due to ECC errors UBI might
pick an older Fastmap to attach from.
While this can only happen on an anyway broken setup it will show
completely different sympthoms and makes finding the root cause much
more difficult.
So, be debug friendly and fall back to scanning mode of we're facing
an ECC error while scanning for Fastmap.

Cc: <stable@vger.kernel.org>
Signed-off-by: Richard Weinberger <richard@nod.at>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/mtd/ubi/attach.c
drivers/mtd/ubi/ubi.h