From 6624ef2ba2e9687929c53fe838910786270cd5c9 Mon Sep 17 00:00:00 2001 From: Artem Bityutskiy Date: Sun, 26 Jul 2009 15:40:32 +0300 Subject: ubiformat: torture eraseblocks on write errors When fail to write to PEBs, and the error is EIO, torture the PEB before marking it as bad. Basically, the code is copied from the kernel UBI. Signed-off-by: Artem Bityutskiy --- ubi-utils/src/ubiformat.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) (limited to 'ubi-utils/src/ubiformat.c') diff --git a/ubi-utils/src/ubiformat.c b/ubi-utils/src/ubiformat.c index 2a62f3b..c15500b 100644 --- a/ubi-utils/src/ubiformat.c +++ b/ubi-utils/src/ubiformat.c @@ -530,12 +530,14 @@ static int flash_image(const struct mtd_dev_info *mtd, struct ubi_scan_info *si) if (errno != EIO) goto out_close; - if (mark_bad(mtd, si, eb)) { - normsg("operation incomplete"); - goto out_close; + err = mtd_torture(mtd, args.node_fd, eb); + if (err) { + if (mark_bad(mtd, si, eb)) { + normsg("operation incomplete"); + goto out_close; + } + divisor += 1; } - - divisor += 1; continue; } if (++written_ebs >= img_ebs) -- cgit v1.2.3