mailarchive of the pengutronix oss-tools mailing list
 help / color / mirror / Atom feed
From: "Ulrich Ölmann" <u.oelmann@pengutronix.de>
To: Pengutronix Public Open-Source-Development <oss-tools@pengutronix.de>
Cc: "Ulrich Ölmann" <u.oelmann@pengutronix.de>
Subject: [OSS-Tools] [PATCH dt-utils 06/13] state: backend_bucket_circular: mark block as bad if mtd_peb_torture() failed
Date: Mon, 30 Sep 2019 09:26:06 +0200
Message-ID: <20190930072613.17956-7-u.oelmann@pengutronix.de> (raw)
In-Reply-To: <20190930072613.17956-1-u.oelmann@pengutronix.de>

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>
---
 src/barebox-state/backend_bucket_circular.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/src/barebox-state/backend_bucket_circular.c b/src/barebox-state/backend_bucket_circular.c
index b2577bcd5ee3..735510e0d36b 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;
-- 
2.23.0


_______________________________________________
OSS-Tools mailing list
OSS-Tools@pengutronix.de

  parent reply	other threads:[~2019-09-30  7:26 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-09-30  7:26 [OSS-Tools] [PATCH dt-utils 00/13] Harmonize dt-utils' and barebox' shared code base Ulrich Ölmann
2019-09-30  7:26 ` [OSS-Tools] [PATCH dt-utils 01/13] state: Fix lseek error check in state_backend_bucket_direct_read() Ulrich Ölmann
2019-09-30  7:26 ` [OSS-Tools] [PATCH dt-utils 02/13] state: Fix lseek error check in state_backend_bucket_direct_write() Ulrich Ölmann
2019-09-30  7:26 ` [OSS-Tools] [PATCH dt-utils 03/13] state: Fix lseek error check in state_mtd_peb_read() Ulrich Ölmann
2019-09-30  7:26 ` [OSS-Tools] [PATCH dt-utils 04/13] state: Fix lseek error check in state_mtd_peb_write() Ulrich Ölmann
2019-09-30  7:26 ` [OSS-Tools] [PATCH dt-utils 05/13] state: check length Ulrich Ölmann
2019-09-30  7:26 ` Ulrich Ölmann [this message]
2019-09-30  7:26 ` [OSS-Tools] [PATCH dt-utils 07/13] state: drop unused code and declarations for non-existing functions Ulrich Ölmann
2019-09-30  7:26 ` [OSS-Tools] [PATCH dt-utils 08/13] state: keep backward compatibility Ulrich Ölmann
2019-10-22  9:46   ` Roland Hieber
2019-09-30  7:26 ` [OSS-Tools] [PATCH dt-utils 09/13] state: backend_storage: harmonize code with barebox Ulrich Ölmann
2019-09-30  7:26 ` [OSS-Tools] [PATCH dt-utils 10/13] state: " Ulrich Ölmann
2019-09-30  7:26 ` [OSS-Tools] [PATCH dt-utils 11/13] " Ulrich Ölmann
2019-09-30  7:26 ` [OSS-Tools] [PATCH dt-utils 12/13] configure: remove build time option '--disable-logging' Ulrich Ölmann
2019-09-30  7:26 ` [OSS-Tools] [PATCH dt-utils 13/13] configure: remove build time option '--enable-debug' Ulrich Ölmann

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190930072613.17956-7-u.oelmann@pengutronix.de \
    --to=u.oelmann@pengutronix.de \
    --cc=oss-tools@pengutronix.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

mailarchive of the pengutronix oss-tools mailing list

This inbox may be cloned and mirrored by anyone:

	git clone --mirror https://lore.pengutronix.de/oss-tools/0 oss-tools/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 oss-tools oss-tools/ https://lore.pengutronix.de/oss-tools \
		oss-tools@pengutronix.de
	public-inbox-index oss-tools

Example config snippet for mirrors.


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git