diff options
author | Ulrich Ölmann <u.oelmann@pengutronix.de> | 2019-09-30 09:26:06 +0200 |
---|---|---|
committer | Roland Hieber <rhi@pengutronix.de> | 2019-10-11 16:49:38 +0200 |
commit | b548f61a04604c13d39873216814c11e19e81240 (patch) | |
tree | ace4731da64adb940b2b6b0f1098813f3e848dc7 | |
parent | a1fe3159ca2a4e1f1271ca15af162b66b5132d07 (diff) | |
download | dt-utils-b548f61a04604c13d39873216814c11e19e81240.tar.gz dt-utils-b548f61a04604c13d39873216814c11e19e81240.tar.xz |
state: backend_bucket_circular: mark block as bad if mtd_peb_torture() failed
This ports the following barebox commit:
| commit 3b68dbcbfce830bdf91f50943e5ee41463717abf
| Author: Sascha Hauer <s.hauer@pengutronix.de>
| Date: Mon Jul 15 15:28:55 2019 +0200
|
| 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>
Signed-off-by: Ulrich Ölmann <u.oelmann@pengutronix.de>
-rw-r--r-- | src/barebox-state/backend_bucket_circular.c | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/src/barebox-state/backend_bucket_circular.c b/src/barebox-state/backend_bucket_circular.c index b2577bc..735510e 100644 --- a/src/barebox-state/backend_bucket_circular.c +++ b/src/barebox-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; |