Skip to contentSkip to conversation

jffs2: don't fail on bitflips in OOB

PATCH Applied Brian Norris 2 participants 2 messages Aug 31, 2012 – Sep 4, 2012

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 jffs2: don't fail on bitflips in OOB

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.

---
 fs/jffs2/wbuf.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
fs/jffs2/wbuf.c +4 -4
index 6f4529d..a6597d6 100644
@@ -1044,10 +1044,10 @@ int jffs2_check_oob_empty(struct jffs2_sb_info *c,
 	ops.datbuf = NULL;
 
 	ret = mtd_read_oob(c->mtd, jeb->offset, &ops);
-	if (ret || ops.oobretlen != ops.ooblen) {
+	if ((ret && !mtd_is_bitflip(ret)) || ops.oobretlen != ops.ooblen) {
 		pr_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;
 	}
@@ -1086,10 +1086,10 @@ int jffs2_check_nand_cleanmarker(struct jffs2_sb_info *c,
 	ops.datbuf = NULL;
 
 	ret = mtd_read_oob(c->mtd, jeb->offset, &ops);
-	if (ret || ops.oobretlen != ops.ooblen) {
+	if ((ret && !mtd_is_bitflip(ret)) || ops.oobretlen != ops.ooblen) {
 		pr_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;
 	}
Signature · 1 line
1.7.11.3
#1 lore raw
Quoted 9 lines · Brian Norris

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.

Pushed to l2-mtd.git, thanks!

Signature · 2 lines
Best Regards,
Artem Bityutskiy