]> git.kernelconcepts.de Git - karo-tx-linux.git/commitdiff
JFFS2: don't fail on bitflips in OOB
authorBrian Norris <computersforpeace@gmail.com>
Fri, 31 Aug 2012 22:01:19 +0000 (15:01 -0700)
committerBen Hutchings <ben@decadent.org.uk>
Wed, 17 Oct 2012 02:49:15 +0000 (03:49 +0100)
commit 74d83beaa229aac7d126ac1ed9414658ff1a89d2 upstream.

JFFS2 was designed without thought for OOB bitflips, it seems, but they
can occur and will be reported to JFFS2 via mtd_read_oob()[1]. We don't
want to fail on these transactions, since the data was corrected.

[1] Few drivers report bitflips for OOB-only transactions. With such
    drivers, this patch should have no effect.

Signed-off-by: Brian Norris <computersforpeace@gmail.com>
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
[bwh: Backported to 3.2: adjust context]
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
fs/jffs2/wbuf.c

index b09e51d2f81f98a1a985cdc410802b909bd361f2..464cd76c9a9571d4ce1f6b7d55537f53de66d506 100644 (file)
@@ -1032,11 +1032,11 @@ int jffs2_check_oob_empty(struct jffs2_sb_info *c,
        ops.datbuf = NULL;
 
        ret = c->mtd->read_oob(c->mtd, jeb->offset, &ops);
-       if (ret || ops.oobretlen != ops.ooblen) {
+       if ((ret && !mtd_is_bitflip(ret)) || ops.oobretlen != ops.ooblen) {
                printk(KERN_ERR "cannot read OOB for EB at %08x, requested %zd"
                                " bytes, read %zd bytes, error %d\n",
                                jeb->offset, ops.ooblen, ops.oobretlen, ret);
-               if (!ret)
+               if (!ret || mtd_is_bitflip(ret))
                        ret = -EIO;
                return ret;
        }
@@ -1075,11 +1075,11 @@ int jffs2_check_nand_cleanmarker(struct jffs2_sb_info *c,
        ops.datbuf = NULL;
 
        ret = c->mtd->read_oob(c->mtd, jeb->offset, &ops);
-       if (ret || ops.oobretlen != ops.ooblen) {
+       if ((ret && !mtd_is_bitflip(ret)) || ops.oobretlen != ops.ooblen) {
                printk(KERN_ERR "cannot read OOB for EB at %08x, requested %zd"
                                " bytes, read %zd bytes, error %d\n",
                                jeb->offset, ops.ooblen, ops.oobretlen, ret);
-               if (!ret)
+               if (!ret || mtd_is_bitflip(ret))
                        ret = -EIO;
                return ret;
        }