ubi: Do "dump_stack()" in case of the ubi_io_read()/ubi_io_write()/do_sync_erase() has an error

Submitted by Xiaoming Zhang on April 23, 2012, 12:31 p.m.

Details

Message ID 4F954BAD.2010606@gmail.com
State New, archived
Headers show

Commit Message

Xiaoming Zhang April 23, 2012, 12:31 p.m.
ubi: Do "dump_stack()" to always have the dump in case of the
ubi_io_read()/ubi_io_write()/do_sync_erase() has an error.

Signed-off-by: Mark Zhang <mark.zhang@motorola.com>
---
  drivers/mtd/ubi/io.c |   10 +++++-----
  1 files changed, 5 insertions(+), 5 deletions(-)


@@ -293,7 +293,7 @@ int ubi_io_write(struct ubi_device *ubi, const void 
*buf, int pnum, int offset,
  	if (err) {
  		ubi_err("error %d while writing %d bytes to PEB %d:%d, written "
  			"%zd bytes", err, len, pnum, offset, written);
-		ubi_dbg_dump_stack();
+		dump_stack();
  		ubi_dbg_dump_flash(ubi, pnum, offset, len);
  	} else
  		ubi_assert(written == len);
@@ -370,7 +370,7 @@ retry:
  			goto retry;
  		}
  		ubi_err("cannot erase PEB %d, error %d", pnum, err);
-		ubi_dbg_dump_stack();
+		dump_stack();
  		return err;
  	}

@@ -388,7 +388,7 @@ retry:
  			goto retry;
  		}
  		ubi_err("cannot erase PEB %d", pnum);
-		ubi_dbg_dump_stack();
+		dump_stack();
  		return -EIO;
  	}

Comments

Artem Bityutskiy April 24, 2012, 3:50 a.m.
On Mon, 2012-04-23 at 20:31 +0800, Mark wrote:
> ubi: Do "dump_stack()" to always have the dump in case of the
> ubi_io_read()/ubi_io_write()/do_sync_erase() has an error.
> 
> Signed-off-by: Mark Zhang <mark.zhang@motorola.com>

Mark, sorry, but this patch is not applicable because it is
1) line-wrapped
2) against some old UBI version.

To check what I mean - save it from the mailing list as mbox and try to
apply it using git am to the upstream kernel.

Also, keep in mind that the subject line should be short and only give
idea what the patch does without details. In this case I'd prefer "UBI:
dump the stack in case of I/O errors".

BTW, I suggest you to use newer kernel or pull one of the ubifs
back-port trees which also contains all the UBI back-ports.

Anyway, I'll do this change myself now.

Patch hide | download patch | download mbox

diff --git a/drivers/mtd/ubi/io.c b/drivers/mtd/ubi/io.c
index 43f1a00..4a866db 100644
--- a/drivers/mtd/ubi/io.c
+++ b/drivers/mtd/ubi/io.c
@@ -198,7 +198,7 @@  retry:

  		ubi_err("error %d%s while reading %d bytes from PEB %d:%d, "
  			"read %zd bytes", err, errstr, len, pnum, offset, read);
-		ubi_dbg_dump_stack();
+		dump_stack();

  		/*
  		 * The driver should never return -EBADMSG if it failed to read
@@ -284,7 +284,7 @@  int ubi_io_write(struct ubi_device *ubi, const void 
*buf, int pnum, int offset,
  	if (ubi_dbg_is_write_failure(ubi)) {
  		dbg_err("cannot write %d bytes to PEB %d:%d "
  			"(emulated)", len, pnum, offset);
-		ubi_dbg_dump_stack();
+		dump_stack();
  		return -EIO;
  	}