summaryrefslogtreecommitdiffstats
path: root/common/state/backend_bucket_circular.c
diff options
context:
space:
mode:
authorSascha Hauer <s.hauer@pengutronix.de>2019-07-15 15:28:55 +0200
committerSascha Hauer <s.hauer@pengutronix.de>2019-07-16 09:04:40 +0200
commit3b68dbcbfce830bdf91f50943e5ee41463717abf (patch)
tree230009208fe715a6e89365645f1a9fc0ef508cf7 /common/state/backend_bucket_circular.c
parent4c216abb0cf5da6f896298fa875cd7bb80dc76b9 (diff)
downloadbarebox-3b68dbcbfce830bdf91f50943e5ee41463717abf.tar.gz
barebox-3b68dbcbfce830bdf91f50943e5ee41463717abf.tar.xz
mtd: peb: Do not mark as bad in mtd_peb_torture()
Both the Kernel and mtd-utils have peb torture functions and both do not mark the block as bad automatically. Instead, the caller must mark the block as bad when -EIO is returned from the torture function. Do the same in barebox. This is necessary as the UBI code otherwise may mark a block as bad twice: Once indirectly in mtd_peb_torture() and then directly afterwards. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'common/state/backend_bucket_circular.c')
-rw-r--r--common/state/backend_bucket_circular.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/common/state/backend_bucket_circular.c b/common/state/backend_bucket_circular.c
index 4676730d05..47970b79f3 100644
--- a/common/state/backend_bucket_circular.c
+++ b/common/state/backend_bucket_circular.c
@@ -95,6 +95,7 @@ static int state_mtd_peb_read(struct state_backend_storage_bucket_circular *circ
if (ret == -EBADMSG) {
ret = mtd_peb_torture(circ->mtd, circ->eraseblock);
if (ret == -EIO) {
+ mtd_peb_mark_bad(circ->mtd, circ->eraseblock);
dev_err(circ->dev, "Tortured eraseblock failed and is marked bad now, PEB %u\n",
circ->eraseblock);
return -EIO;
@@ -132,6 +133,7 @@ static int state_mtd_peb_write(struct state_backend_storage_bucket_circular *cir
if (ret == -EBADMSG) {
ret = mtd_peb_torture(circ->mtd, circ->eraseblock);
if (ret == -EIO) {
+ mtd_peb_mark_bad(circ->mtd, circ->eraseblock);
dev_err(circ->dev, "Tortured eraseblock failed and is marked bad now, PEB %u\n",
circ->eraseblock);
return -EIO;