Messages in this thread | | | Subject | Re: [PATCH 1/1] ubi: remove and create MTD device back when UBI volume is resized | From | Artem Bityutskiy <> | Date | Fri, 16 Aug 2013 17:07:31 +0300 |
| |
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
| |