[PATCH] UBI: Do not try to autoresize in readonly mode

Artem Bityutskiy dedekind1 at gmail.com
Fri Aug 24 11:29:31 EDT 2012


On Sat, 2012-08-18 at 14:11 +0200, Pali Rohár wrote:
> I'm sending small patch which skip autoresizing ubi in readonly 
> mode. I think it is really not good idea to try resize in ro 
> mode.

Hi, I've just pushed a similar patch to linux-ubi.git, is this fine with
you? I've also CCed -stable.

From: Artem Bityutskiy <artem.bityutskiy at linux.intel.com>
Date: Sat, 18 Aug 2012 14:11:42 +0200
Subject: [PATCH] UBI: fix autoresize handling in R/O mode

Currently UBI fails in autoresize when it is in R/O mode (e.g., because the
underlying MTD device is R/O). This patch fixes the issue - we just skip
autoresize and print a warning.

Reported-by: Pali Rohár <pali.rohar at gmail.com>
Cc: stable at vger.kernel.org
Signed-off-by: Artem Bityutskiy <artem.bityutskiy at linux.intel.com>
---
 drivers/mtd/ubi/build.c |    5 +++++
 1 file changed, 5 insertions(+)

diff --git a/drivers/mtd/ubi/build.c b/drivers/mtd/ubi/build.c
index 355756b..8966088 100644
--- a/drivers/mtd/ubi/build.c
+++ b/drivers/mtd/ubi/build.c
@@ -799,6 +799,11 @@ static int autoresize(struct ubi_device *ubi, int vol_id)
 	struct ubi_volume *vol = ubi->volumes[vol_id];
 	int err, old_reserved_pebs = vol->reserved_pebs;
 
+	if (ubi->ro_mode) {
+		ubi_warn("skip auto-resize because of R/O mode");
+		return 0;
+	}
+
 	/*
 	 * Clear the auto-resize flag in the volume in-memory copy of the
 	 * volume table, and 'ubi_resize_volume()' will propagate this change
-- 
1.7.10.4


> BTW, is there userspace tool for unpacking data from ubifs image 
> without need to simulate nand device in kernel?

Unfortunately no.

-- 
Best Regards,
Artem Bityutskiy
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: This is a digitally signed message part
URL: <http://lists.infradead.org/pipermail/linux-mtd/attachments/20120824/dd90a051/attachment.sig>


More information about the linux-mtd mailing list