public inbox for linux-mtd@lists.infradead.org
 help / color / mirror / Atom feed
From: "Pali Rohár" <pali.rohar@gmail.com>
To: Artem Bityutskiy <dedekind1@gmail.com>
Cc: linux-mtd@lists.infradead.org
Subject: [PATCH] UBI: Do not try to autoresize in readonly mode
Date: Sat, 18 Aug 2012 14:11:42 +0200	[thread overview]
Message-ID: <8381186.XTLIOQGYR2@pali> (raw)

[-- Attachment #1: Type: text/plain, Size: 1403 bytes --]

Hello,

when I'm tried to mount ubifs image from readonly mtd device (e.g 
virtual, only for unpacking data) it failed because image has 
autoresize flag on ubi block. ubi build.c code trying to 
autoresize ubi image if has autoresize flag and if autoresize 
failed, attaching ubi failed. So it is not possible to mount 
ubifs image if ubi has autoresize flag in read only mode (because 
resizing is not possible on read only device).

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.

diff --git a/drivers/mtd/ubi/build.c b/drivers/mtd/ubi/build.c
index 738772c..ad911ab 100644
--- a/drivers/mtd/ubi/build.c
+++ b/drivers/mtd/ubi/build.c
@@ -927,7 +927,7 @@ int ubi_attach_mtd_dev(struct mtd_info *mtd, 
int ubi_num, int vid_hdr_offset)
 		goto out_debugging;
 	}
 
-	if (ubi->autoresize_vol_id != -1) {
+	if (!ubi->ro_mode && ubi->autoresize_vol_id != -1) {
 		err = autoresize(ubi, ubi->autoresize_vol_id);
 		if (err)
 			goto out_detach;

With this patch I'm able to mount & unpack data from ubifs image 
on read only (virtual/simulated) nand device with autoresize 
flag. Consider including this patch to ubi-2.6 git tree.

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

-- 
Pali Rohár
pali.rohar@gmail.com

[-- Attachment #2: This is a digitally signed message part. --]
[-- Type: application/pgp-signature, Size: 198 bytes --]

             reply	other threads:[~2012-08-18 12:11 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-08-18 12:11 Pali Rohár [this message]
2012-08-24 15:29 ` [PATCH] UBI: Do not try to autoresize in readonly mode Artem Bityutskiy
2012-08-24 15:48   ` Pali Rohár
2012-08-24 15:57     ` Artem Bityutskiy
2012-08-24 15:59       ` Pali Rohár
2012-08-24 16:09         ` Artem Bityutskiy
2017-06-02 15:39           ` Pali Rohár

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=8381186.XTLIOQGYR2@pali \
    --to=pali.rohar@gmail.com \
    --cc=dedekind1@gmail.com \
    --cc=linux-mtd@lists.infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox