aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/mtd/ubi/scan.c
diff options
context:
space:
mode:
authorArtem Bityutskiy <Artem.Bityutskiy@nokia.com>2010-09-03 07:22:17 -0400
committerArtem Bityutskiy <Artem.Bityutskiy@nokia.com>2010-10-19 10:19:56 -0400
commit92e1a7d9e7e07fb1cf0cbbcdf202938d0819b54d (patch)
tree48930121fa2f1cf9ebd36f85118fe433d1ecd01f /drivers/mtd/ubi/scan.c
parent74d82d2660058e32644f0c673656b2a1d01d3688 (diff)
UBI: handle bit-flips when no header found
Currently UBI has one small flaw - when we read EC or VID header, but find only 0xFF bytes, we return UBI_IO_FF and do not report whether we had bit-flips or not. In case of the VID header, the scanning code adds this PEB to the free list, even though there were bit-flips. Imagine the following situation: we start writing VID header to a PEB and have a power cut, so the PEB becomes unstable. When we scan and read the PEB, we get a bit-flip. Currently, UBI would just ignore this and treat the PEB as free. This patch changes UBI behavior and now UBI will schedule this PEB for erasure. Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
Diffstat (limited to 'drivers/mtd/ubi/scan.c')
-rw-r--r--drivers/mtd/ubi/scan.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/drivers/mtd/ubi/scan.c b/drivers/mtd/ubi/scan.c
index 37cb18ff10c6..6f9080767e3f 100644
--- a/drivers/mtd/ubi/scan.c
+++ b/drivers/mtd/ubi/scan.c
@@ -748,7 +748,7 @@ static int process_eb(struct ubi_device *ubi, struct ubi_scan_info *si,
748 return err; 748 return err;
749 else if (err == UBI_IO_BITFLIPS) 749 else if (err == UBI_IO_BITFLIPS)
750 bitflips = 1; 750 bitflips = 1;
751 else if (err == UBI_IO_FF) 751 else if (err == UBI_IO_FF || err == UBI_IO_FF_BITFLIPS)
752 return add_to_list(si, pnum, UBI_SCAN_UNKNOWN_EC, &si->erase); 752 return add_to_list(si, pnum, UBI_SCAN_UNKNOWN_EC, &si->erase);
753 else if (err == UBI_IO_BAD_HDR_EBADMSG || err == UBI_IO_BAD_HDR) { 753 else if (err == UBI_IO_BAD_HDR_EBADMSG || err == UBI_IO_BAD_HDR) {
754 /* 754 /*
@@ -817,7 +817,7 @@ static int process_eb(struct ubi_device *ubi, struct ubi_scan_info *si,
817 else if (err == UBI_IO_BITFLIPS) 817 else if (err == UBI_IO_BITFLIPS)
818 bitflips = 1; 818 bitflips = 1;
819 else if (err == UBI_IO_BAD_HDR_EBADMSG || err == UBI_IO_BAD_HDR || 819 else if (err == UBI_IO_BAD_HDR_EBADMSG || err == UBI_IO_BAD_HDR ||
820 (err == UBI_IO_FF && ec_corr)) { 820 (err == UBI_IO_FF && ec_corr) || err == UBI_IO_FF_BITFLIPS) {
821 /* VID header is corrupted */ 821 /* VID header is corrupted */
822 if (err == UBI_IO_BAD_HDR_EBADMSG || 822 if (err == UBI_IO_BAD_HDR_EBADMSG ||
823 ec_corr == UBI_IO_BAD_HDR_EBADMSG) 823 ec_corr == UBI_IO_BAD_HDR_EBADMSG)