[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <1305751647-3122-1-git-send-email-bengardiner@nanometrics.ca>
Date: Wed, 18 May 2011 16:47:27 -0400
From: Ben Gardiner <bengardiner@...ometrics.ca>
To: Artem Bityutskiy <dedekind1@...il.com>
Cc: Adrian Hunter <adrian.hunter@...ia.com>,
linux-mtd@...ts.infradead.org, linux-kernel@...r.kernel.org,
"Matthew L. Creech" <mlcreech@...il.com>
Subject: [PATCH] UBIFS: don't fail on -EBADMSG when fixing free space
The free space fixup was introduced so that UBIFS on NAND flashes where the
empty pages at the end need to be dropped when flashing or else -74
(aka -EBADMSG) failures will occur -- but due to the limited functionality of
flash-programming facilities the emtpy pages cannot be dropped.
In fixup_leb, which is called during free space fixup, the now-expected return
code of -EBADMSG is treated as a failure.
Don't fail when -EBADMSG is encountered during ubi_read.
Signed-off-by: Ben Gardiner <bengardiner@...ometrics.ca>
CC: Matthew L. Creech <mlcreech@...il.com>
---
I tested this patch on-top-of l2 head : 'bbf2b37 UBIFS: fix extremely rare
mount failure' using Matthew's 'mkfs.ubifs: add "-F" option for "free-space
fixup"' patch to create the UBIFS image with the flag set.
The test system was a da850evm, the image was flashed with U-boot's plain-old
'nand write' and the rootfs is mounted with 'ubi.mtd=X,2048 root=ubi0:rootfs
rootfstype=ubifs' bootargs.
Without this patch the first attemp to start fixing free space fails
with -EBADMSG:
UBIFS: start fixing up free space
UBI error: ubi_io_read: error -74 (ECC error) while reading 4096 bytes from PEB 18:4096, read 4096 bytes
VFS: Cannot open root device "ubi0:rootfs" or unknown-block(0,0)
[...]
---
fs/ubifs/sb.c | 8 +++++++-
1 files changed, 7 insertions(+), 1 deletions(-)
diff --git a/fs/ubifs/sb.c b/fs/ubifs/sb.c
index c606f01..6e7da54 100644
--- a/fs/ubifs/sb.c
+++ b/fs/ubifs/sb.c
@@ -1,3 +1,4 @@
+#define DEBUG
/*
* This file is part of UBIFS.
*
@@ -679,7 +680,12 @@ static int fixup_leb(struct ubifs_info *c, int lnum, int len)
dbg_mnt("fixup LEB %d, data len %d", lnum, len);
err = ubi_read(c->ubi, lnum, c->sbuf, 0, len);
- if (err)
+ /*
+ * Don't fail on -EBADMSG since these are precisely the error codes that
+ * are returned by ubi_red in the cases where free-space fix-ups are
+ * required.
+ */
+ if (err && err != -EBADMSG)
return err;
return ubi_leb_change(c->ubi, lnum, c->sbuf, len, UBI_UNKNOWN);
--
1.7.4.1
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists