Bug in mtd_get_device_size()?

Velykokhatko, Sergey Sergey.Velykokhatko at mcc-med.de
Thu Feb 28 07:30:45 EST 2013


Hi guys,



I got today such case:

      * Kernel 3.8

      * We are using M29F2G16 NAND chip with 4096 blocks, each has 128k

      * Configured with CONFIG_MTD_UBI_BEB_LIMIT=100

      * Our rootfs partition contains 640 EBs

      * At system start comes following error message:



Feb 28 09:23:09 (none) kern.notice kernel: [    0.375000] Creating 6 MTD partitions on "atmel_nand":

Feb 28 09:23:09 (none) kern.notice kernel: [    0.375000] 0x000000000000-0x000000020000 : "obsolete_bootstrap"

Feb 28 09:23:09 (none) kern.notice kernel: [    0.381000] 0x000000020000-0x000000320000 : "kernel_a"

Feb 28 09:23:09 (none) kern.notice kernel: [    0.386000] 0x000000320000-0x000000620000 : "kernel_b"

Feb 28 09:23:09 (none) kern.notice kernel: [    0.392000] 0x000000620000-0x000005620000 : "rootfs_a"

Feb 28 09:23:09 (none) kern.notice kernel: [    0.399000] 0x000005620000-0x00000a620000 : "rootfs_b"

Feb 28 09:23:09 (none) kern.notice kernel: [    0.406000] 0x00000a620000-0x000020000000 : "config_data"

...



Feb 28 09:23:10 (none) kern.info kernel: [    0.546000] NET: Registered protocol family 17

Feb 28 09:23:10 (none) kern.notice kernel: [    0.557000] UBI: attaching mtd3 to ubi0

Feb 28 09:23:10 (none) kern.info kernel: [    0.748000] usb 1-2: new high-speed USB device number 2 using atmel-ehci

Feb 28 09:23:10 (none) kern.notice kernel: [    0.810000] UBI: scanning is finished

Feb 28 09:23:10 (none) kern.warn kernel: [    0.821000] UBI warning: print_rsvd_warning: cannot reserve enough PEBs for bad PEB handling, reserved 115, need 400

Feb 28 09:23:10 (none) kern.notice kernel: [    0.826000] UBI: attached mtd3 (name "rootfs_a", size 80 MiB) to ubi0

Feb 28 09:23:10 (none) kern.notice kernel: [    0.826000] UBI: PEB size: 131072 bytes (128 KiB), LEB size: 129024 bytes

Feb 28 09:23:10 (none) kern.notice kernel: [    0.826000] UBI: min./max. I/O unit sizes: 2048/2048, sub-page size 512

Feb 28 09:23:10 (none) kern.notice kernel: [    0.826000] UBI: VID header offset: 512 (aligned 512), data offset: 2048

Feb 28 09:23:10 (none) kern.notice kernel: [    0.826000] UBI: good PEBs: 640, bad PEBs: 0, corrupted PEBs: 0

Feb 28 09:23:10 (none) kern.notice kernel: [    0.826000] UBI: user volume: 1, internal volumes: 1, max. volumes count: 128

Feb 28 09:23:10 (none) kern.notice kernel: [    0.826000] UBI: max/mean erase counter: 399/202, WL threshold: 4096, image sequence number: 548304255

Feb 28 09:23:10 (none) kern.notice kernel: [    0.826000] UBI: available PEBs: 0, total reserved PEBs: 640, PEBs reserved for bad PEB handling: 115

Feb 28 09:23:10 (none) kern.notice kernel: [    0.827000] UBI: background thread "ubi_bgt0d" started, PID 288





UBI wanted to reserve 400 blocks on MTD with 640. Hm... During debugging I found that mtd_get_device_size() gives the size of whole flash memory back (4096 blocks * 128kB). I guess that I found small error. With micro patch the problem seems to be corrected for my case





Thanks a lot,

Best regards

Sergey


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.infradead.org/pipermail/linux-mtd/attachments/20130228/1ecadf5f/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-Instead-of-giving-the-size-of-requested-MTD-partitio.patch
Type: application/octet-stream
Size: 880 bytes
Desc: 0001-Instead-of-giving-the-size-of-requested-MTD-partitio.patch
URL: <http://lists.infradead.org/pipermail/linux-mtd/attachments/20130228/1ecadf5f/attachment.obj>


More information about the linux-mtd mailing list