public inbox for linux-mtd@lists.infradead.org
 help / color / mirror / Atom feed
* [PATCH] UBI: init_volumes: Ignore volumes with no LEBs
@ 2014-07-08 14:04 Richard Weinberger
  2014-07-16  8:31 ` Artem Bityutskiy
  0 siblings, 1 reply; 2+ messages in thread
From: Richard Weinberger @ 2014-07-08 14:04 UTC (permalink / raw)
  To: dedekind1
  Cc: linux-mtd, computersforpeace, dwmw2, linux-kernel,
	Richard Weinberger

UBI assumes that ubi_attach_info will only contain ubi_ainf_volume
structures for volumes with at least one LEB.
In scanning mode this is true because UBI can nicely create a ubi_ainf_volume
on demand while creating the EBA table.

For fastmap this is not true, the fastmap on-flash structure has a list of
all volumes, the ubi_ainf_volume structures are created from this list.
So it can happen that an empty volume ends up in init_volumes().

We can easely deal with that by looking into ->leb_count too.

Signed-off-by: Richard Weinberger <richard@nod.at>
---
 drivers/mtd/ubi/vtbl.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/mtd/ubi/vtbl.c b/drivers/mtd/ubi/vtbl.c
index d77b1c1..07cac5f 100644
--- a/drivers/mtd/ubi/vtbl.c
+++ b/drivers/mtd/ubi/vtbl.c
@@ -591,7 +591,7 @@ static int init_volumes(struct ubi_device *ubi,
 
 		/* Static volumes only */
 		av = ubi_find_av(ai, i);
-		if (!av) {
+		if (!av || !av->leb_count) {
 			/*
 			 * No eraseblocks belonging to this volume found. We
 			 * don't actually know whether this static volume is
-- 
2.0.1

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] UBI: init_volumes: Ignore volumes with no LEBs
  2014-07-08 14:04 [PATCH] UBI: init_volumes: Ignore volumes with no LEBs Richard Weinberger
@ 2014-07-16  8:31 ` Artem Bityutskiy
  0 siblings, 0 replies; 2+ messages in thread
From: Artem Bityutskiy @ 2014-07-16  8:31 UTC (permalink / raw)
  To: Richard Weinberger; +Cc: linux-mtd, computersforpeace, dwmw2, linux-kernel

On Tue, 2014-07-08 at 16:04 +0200, Richard Weinberger wrote:
> UBI assumes that ubi_attach_info will only contain ubi_ainf_volume
> structures for volumes with at least one LEB.
> In scanning mode this is true because UBI can nicely create a ubi_ainf_volume
> on demand while creating the EBA table.

Applied to linux-ubifs.git, thanks!

-- 
Best Regards,
Artem Bityutskiy

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2014-07-16  8:31 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-07-08 14:04 [PATCH] UBI: init_volumes: Ignore volumes with no LEBs Richard Weinberger
2014-07-16  8:31 ` Artem Bityutskiy

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox