mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Artem Bityutskiy <dedekind1@gmail.com>
To: Andrew Rybchenko <Andrew.Rybchenko@oktetlabs.ru>
Cc: linux-mtd@lists.infradead.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH 1/1] ubi: remove and create MTD device back when UBI volume is resized
Date: Fri, 16 Aug 2013 17:07:31 +0300	[thread overview]
Message-ID: <1376662051.2089.371.camel@sauron.fi.intel.com> (raw)
In-Reply-To: <1376306265-8671-1-git-send-email-Andrew.Rybchenko@oktetlabs.ru>

On Mon, 2013-08-12 at 15:17 +0400, Andrew Rybchenko wrote:
> If underlying MTD device size is simply corrected (as it was before),
> MTD block device is not notified about MTD device size change. As the
> result, for example, mount fails after create with zero size, resize,
> write file system image.
> 
> Side effect of the patch is change of MTD device number on resize/update.
> 
> Signed-off-by: Andrew Rybchenko <Andrew.Rybchenko@oktetlabs.ru>

Usually MTD devices never change their size, and the whole MTD subsystem
is implemented with this assumption, and the users of the MTD interface
have the same assumption - MTD devices do not size change their size.

So this change is fixing one problem by introducing another problem -
now not only the size may change, but the device number may change, and
even more ...

> +		gluebi_remove(&nt->vi);

... the device may just disappear for a while (not, the mtd mutex is
dropped here).

> +		gluebi_create(&nt->di, &nt->vi);

... then appear again in a different form :-)

When you remove the device, you also remove its sysfs files. And then
re-creates it. What an app keeps it open? Not big deal, it'll just get a
read error next time it reads it.

Anyway, this patch is not ideal.

I guess the right way to solve the problem would be to just prohibit
re-sizing a UBI volumes if we use gluebi.

Or just put the entire emulated MTD device to some "invalid" state if
the underlying UBI volume was resized. May be not always, but only if it
became smaller.

Or something else.

Anyway, I do acknowledge this is a problem, but I am not sure this is a
good solution...

-- 
Best Regards,
Artem Bityutskiy


      reply	other threads:[~2013-08-16 14:02 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-08-12 11:17 Andrew Rybchenko
2013-08-16 14:07 ` Artem Bityutskiy [this message]

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=1376662051.2089.371.camel@sauron.fi.intel.com \
    --to=dedekind1@gmail.com \
    --cc=Andrew.Rybchenko@oktetlabs.ru \
    --cc=linux-kernel@vger.kernel.org \
    --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

all inboxes | Powered by JetHome®