All of lore.kernel.org
 help / color / mirror / Atom feed
* Bad blocks while attaching UBIFS
@ 2013-11-06 15:35 Fernando Silveira
  2013-11-07 11:04 ` Artem Bityutskiy
  0 siblings, 1 reply; 3+ messages in thread
From: Fernando Silveira @ 2013-11-06 15:35 UTC (permalink / raw)
  To: linux-mtd

Hi,

I'm using an yet unreleased NAND flash controller with my own MTD
driver and everything is working perfectly except for one thing: after
a few weeks UBIFS begins to throw some error messages while attaching
and a few days later it just doesn't attach anymore. I know bad blocks
are supposed to appear after rewriting lots of data but it seems to me
that UBIFS is not marking the "attach" blocks as bad nor wear leveling
the "attach/info" sector. The error message follows below:

UBI: attaching mtd3 to ubi0
UBI: physical eraseblock size:   2097152 bytes (2048 KiB)
UBI: logical eraseblock size:    2080768 bytes
UBI: smallest flash I/O unit:    8192
UBI: VID header offset:          8192 (aligned 8192)
UBI: data offset:                16384
[my mtd driver printing error messages while trying to read a block]
UBI error: ubi_io_read: error -5 while reading 64 bytes from PEB
3394:0, read 0 bytes

Note that once a UBIFS file system starts to fail, that PEB indicated
in the "ubi_io_read" error seems to never change. I'll take a closer
look at this detail if I see more errors.

My questions are:

  1. Does UBIFS mark a bad block when it is failing to attach?
  2. If yes, what might be wrong with my driver?
  3. If not, what should I do to prevent a failure while attaching?

PS: I rarely see a bad block being set/found by UBIFS, but the errors
in the attach procedure are VERY frequent.

Regards,

-- 
Fernando Silveira

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

* Re: Bad blocks while attaching UBIFS
  2013-11-06 15:35 Bad blocks while attaching UBIFS Fernando Silveira
@ 2013-11-07 11:04 ` Artem Bityutskiy
  2013-11-12 18:42   ` Fernando Silveira
  0 siblings, 1 reply; 3+ messages in thread
From: Artem Bityutskiy @ 2013-11-07 11:04 UTC (permalink / raw)
  To: Fernando Silveira; +Cc: linux-mtd

On Wed, 2013-11-06 at 13:35 -0200, Fernando Silveira wrote:
> Hi,
> 
> I'm using an yet unreleased NAND flash controller with my own MTD
> driver and everything is working perfectly except for one thing: after
> a few weeks UBIFS begins to throw some error messages while attaching
> and a few days later it just doesn't attach anymore. I know bad blocks
> are supposed to appear after rewriting lots of data but it seems to me
> that UBIFS is not marking the "attach" blocks as bad nor wear leveling
> the "attach/info" sector. The error message follows below:
> 
> UBI: attaching mtd3 to ubi0
> UBI: physical eraseblock size:   2097152 bytes (2048 KiB)
> UBI: logical eraseblock size:    2080768 bytes
> UBI: smallest flash I/O unit:    8192
> UBI: VID header offset:          8192 (aligned 8192)
> UBI: data offset:                16384
> [my mtd driver printing error messages while trying to read a block]
> UBI error: ubi_io_read: error -5 while reading 64 bytes from PEB
> 3394:0, read 0 bytes
> 
> Note that once a UBIFS file system starts to fail, that PEB indicated
> in the "ubi_io_read" error seems to never change. I'll take a closer
> look at this detail if I see more errors.
> 
> My questions are:
> 
>   1. Does UBIFS mark a bad block when it is failing to attach?

UBI marks eraseblocks as bad when it cannot write or erase. And blocks
are not marked a s bad right away. Instead, they are first "tortured",
and if the torture test fails, then the eraseblock is marked as bad.

>   2. If yes, what might be wrong with my driver?

Does it handle short reads properly? Please, run mtd tests to validate
your driver.

-- 
Best Regards,
Artem Bityutskiy

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

* Re: Bad blocks while attaching UBIFS
  2013-11-07 11:04 ` Artem Bityutskiy
@ 2013-11-12 18:42   ` Fernando Silveira
  0 siblings, 0 replies; 3+ messages in thread
From: Fernando Silveira @ 2013-11-12 18:42 UTC (permalink / raw)
  To: dedekind1; +Cc: linux-mtd

On Thu, Nov 7, 2013 at 9:04 AM, Artem Bityutskiy <dedekind1@gmail.com> wrote:
>>   2. If yes, what might be wrong with my driver?
>
> Does it handle short reads properly? Please, run mtd tests to validate
> your driver.

There is a bug in the error detection algorithm within my driver/flash
controller and I'm debugging it to fix the problem.

In the mean time I'd like to know if a simple UBI attach procedure
(e.g. "ubi.mtd=root" at the Linux cmdline) writes anything to the
flash or not. And what about a read-only mount of a UBIFS partition?
Does it write anything?

I'm worried about it because my flash has a VERY low limit for
erasing/writing blocks and I'd like to avoid passing read-only
arguments to the "mtdparts" parameter (e.g.
"mtdparts=mynand:8m(boot),-(root)ro") and base only whether I write to
/dev/ubiX or mount the UBIFS partitions in read-write mode.

Regards.

-- 
Fernando Silveira

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

end of thread, other threads:[~2013-11-12 18:43 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-11-06 15:35 Bad blocks while attaching UBIFS Fernando Silveira
2013-11-07 11:04 ` Artem Bityutskiy
2013-11-12 18:42   ` Fernando Silveira

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.