From patchwork Fri Aug 24 15:29:31 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: UBI: Do not try to autoresize in readonly mode Date: Fri, 24 Aug 2012 05:29:31 -0000 From: Artem Bityutskiy X-Patchwork-Id: 179862 Message-Id: <1345822171.2848.325.camel@sauron.fi.intel.com> To: Pali =?ISO-8859-1?Q?Roh=E1r?= Cc: linux-mtd@lists.infradead.org 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 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 Cc: stable@vger.kernel.org Signed-off-by: Artem Bityutskiy --- 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