1. 27 3月, 2015 8 次提交
  2. 26 3月, 2015 5 次提交
  3. 24 2月, 2015 1 次提交
  4. 13 2月, 2015 2 次提交
  5. 28 1月, 2015 10 次提交
    • R
      832b52a1
    • H
      UBI: fix soft lockup in ubi_check_volume() · 9aa272b4
      hujianyang 提交于
      Running mtd-utils/tests/ubi-tests/io_basic.c could cause
      soft lockup or watchdog reset. It is because *updatevol*
      will perform ubi_check_volume() after updating finish
      and this function will full scan the updated lebs if the
      volume is initialized as STATIC_VOLUME.
      
      This patch adds *cond_resched()* in the loop of lebs scan
      to avoid soft lockup.
      
      Helped by Richard Weinberger <richard@nod.at>
      
      [ 2158.067096] INFO: rcu_sched self-detected stall on CPU { 1}  (t=2101 jiffies g=1606 c=1605 q=56)
      [ 2158.172867] CPU: 1 PID: 2073 Comm: io_basic Tainted: G           O 3.10.53 #21
      [ 2158.172898] [<c000f624>] (unwind_backtrace+0x0/0x120) from [<c000c294>] (show_stack+0x10/0x14)
      [ 2158.172918] [<c000c294>] (show_stack+0x10/0x14) from [<c008ac3c>] (rcu_check_callbacks+0x1c0/0x660)
      [ 2158.172936] [<c008ac3c>] (rcu_check_callbacks+0x1c0/0x660) from [<c002b480>] (update_process_times+0x38/0x64)
      [ 2158.172953] [<c002b480>] (update_process_times+0x38/0x64) from [<c005ff38>] (tick_sched_handle+0x54/0x60)
      [ 2158.172966] [<c005ff38>] (tick_sched_handle+0x54/0x60) from [<c00601ac>] (tick_sched_timer+0x44/0x74)
      [ 2158.172978] [<c00601ac>] (tick_sched_timer+0x44/0x74) from [<c003f348>] (__run_hrtimer+0xc8/0x1b8)
      [ 2158.172992] [<c003f348>] (__run_hrtimer+0xc8/0x1b8) from [<c003fd9c>] (hrtimer_interrupt+0x128/0x2a4)
      [ 2158.173007] [<c003fd9c>] (hrtimer_interrupt+0x128/0x2a4) from [<c0246f1c>] (arch_timer_handler_virt+0x28/0x30)
      [ 2158.173022] [<c0246f1c>] (arch_timer_handler_virt+0x28/0x30) from [<c0086214>] (handle_percpu_devid_irq+0x9c/0x124)
      [ 2158.173036] [<c0086214>] (handle_percpu_devid_irq+0x9c/0x124) from [<c0082bd8>] (generic_handle_irq+0x20/0x30)
      [ 2158.173049] [<c0082bd8>] (generic_handle_irq+0x20/0x30) from [<c000969c>] (handle_IRQ+0x64/0x8c)
      [ 2158.173060] [<c000969c>] (handle_IRQ+0x64/0x8c) from [<c0008544>] (gic_handle_irq+0x3c/0x60)
      [ 2158.173074] [<c0008544>] (gic_handle_irq+0x3c/0x60) from [<c02f0f80>] (__irq_svc+0x40/0x50)
      [ 2158.173083] Exception stack(0xc4043c98 to 0xc4043ce0)
      [ 2158.173092] 3c80:                                                       c4043ce4 00000019
      [ 2158.173102] 3ca0: 1f8a865f c050ad10 1f8a864c 00000031 c04b5970 0003ebce 00000000 f3550000
      [ 2158.173113] 3cc0: bf00bc68 00000800 0003ebce c4043ce0 c0186d14 c0186cb8 80000013 ffffffff
      [ 2158.173130] [<c02f0f80>] (__irq_svc+0x40/0x50) from [<c0186cb8>] (read_current_timer+0x4/0x38)
      [ 2158.173145] [<c0186cb8>] (read_current_timer+0x4/0x38) from [<1f8a865f>] (0x1f8a865f)
      [ 2183.927097] BUG: soft lockup - CPU#1 stuck for 22s! [io_basic:2073]
      [ 2184.002229] Modules linked in: nandflash(O) [last unloaded: nandflash]
      Signed-off-by: NWang Kai <morgan.wang@huawei.com>
      Signed-off-by: Nhujianyang <hujianyang@huawei.com>
      Signed-off-by: NRichard Weinberger <richard@nod.at>
      9aa272b4
    • R
      UBI: Fastmap: Care about the protection queue · 4f5e3b6f
      Richard Weinberger 提交于
      Fastmap can miss a PEB if it is in the protection queue
      and not jet in the used tree.
      Treat every protected PEB as used.
      Signed-off-by: NRichard Weinberger <richard@nod.at>
      Signed-off-by: NArtem Bityutskiy <artem.bityutskiy@linux.intel.com>
      4f5e3b6f
    • A
      UBI: do propagate positive error codes up · 0e707ae7
      Artem Bityutskiy 提交于
      UBI uses positive function return codes internally, and should not propagate
      them up, except in the place this path fixes. Here is the original bug report
      from Dan Carpenter:
      
      The problem is really in ubi_eba_read_leb().
      
      drivers/mtd/ubi/eba.c
         412                  err = ubi_io_read_vid_hdr(ubi, pnum, vid_hdr, 1);
         413                  if (err && err != UBI_IO_BITFLIPS) {
         414                          if (err > 0) {
         415                                  /*
         416                                   * The header is either absent or corrupted.
         417                                   * The former case means there is a bug -
         418                                   * switch to read-only mode just in case.
         419                                   * The latter case means a real corruption - we
         420                                   * may try to recover data. FIXME: but this is
         421                                   * not implemented.
         422                                   */
         423                                  if (err == UBI_IO_BAD_HDR_EBADMSG ||
         424                                      err == UBI_IO_BAD_HDR) {
         425                                          ubi_warn("corrupted VID header at PEB %d, LEB %d:%d",
         426                                                   pnum, vol_id, lnum);
         427                                          err = -EBADMSG;
         428                                  } else
         429                                          ubi_ro_mode(ubi);
      
      On this path we return UBI_IO_FF and UBI_IO_FF_BITFLIPS and it
      eventually gets passed to ERR_PTR().  We probably dereference the bad
      pointer and oops.  At that point we've gone read only so it was already
      a bad situation...
      
         430                          }
         431                          goto out_free;
         432                  } else if (err == UBI_IO_BITFLIPS)
         433                          scrub = 1;
         434
      Reported-by: NDan Carpenter <dan.carpenter@oracle.com>
      Signed-off-by: NArtem Bityutskiy <artem.bityutskiy@linux.intel.com>
      0e707ae7
    • A
      UBI: clean-up printing helpers · 39990c6e
      Artem Bityutskiy 提交于
      Let's prefix UBI messages with 'ubiX' instead of 'UBI-X' - this is more
      consistent with the way we name UBI devices.
      
      Also, commit "32608703 UBI: Extend UBI layer debug/messaging capabilities"
      added the function name print to 'ubi_msg()' - lets revert this change, since
      these messages are supposed to be just informative messages, and not debugging
      messages.
      Signed-off-by: NArtem Bityutskiy <artem.bityutskiy@linux.intel.com>
      39990c6e
    • T
      UBI: extend UBI layer debug/messaging capabilities - cosmetics · 45fc5c81
      Tanya Brokhman 提交于
      Some cosmetic fixes to the patch "UBI: Extend UBI layer debug/messaging
      capabilities".
      Signed-off-by: NTanya Brokhman <tlinder@codeaurora.org>
      Signed-off-by: NArtem Bityutskiy <artem.bityutskiy@linux.intel.com>
      45fc5c81
    • R
      UBI: Block: Add blk-mq support · ff1f48ee
      Richard Weinberger 提交于
      Convert the driver to blk-mq.
      Beside of moving to the modern block interface this change boosts
      also the performance of the driver.
      
      nand: device found, Manufacturer ID: 0x2c, Chip ID: 0xda
      nand: Micron NAND 256MiB 3,3V 8-bit
      nand: 256MiB, SLC, page size: 2048, OOB size: 64
      
      root@debian-armhf:~# dd if=/dev/ubiblock0_0 of=/dev/zero bs=1M
      243+1 records in
      243+1 records out
      255080448 bytes (255 MB) copied, 4.39295 s, 58.1 MB/s
      
      vs.
      
      root@debian-armhf:~# dd if=/dev/ubiblock0_0 of=/dev/zero bs=1M
      243+1 records in
      243+1 records out
      255080448 bytes (255 MB) copied, 2.87676 s, 88.7 MB/s
      
      Cc: hch@infradead.org
      Cc: axboe@fb.com
      Cc: tom.leiming@gmail.com
      Signed-off-by: NRichard Weinberger <richard@nod.at>
      Tested-by: NEzequiel Garcia <ezequiel@vanguardiasur.com.ar>
      Reviewed-by: NJens Axboe <axboe@fb.com>
      Acked-by: NEzequiel Garcia <ezequiel@vanguardiasur.com.ar>
      ff1f48ee
    • R
      UBI: Add initial support for scatter gather · 9ff08979
      Richard Weinberger 提交于
      Adds a new set of functions to deal with scatter gather.
      ubi_eba_read_leb_sg() will read from a LEB into a scatter gather list.
      The new data structure struct ubi_sgl will be used within UBI to
      hold the scatter gather list itself and metadata to have a cursor
      within the list.
      Signed-off-by: NRichard Weinberger <richard@nod.at>
      Tested-by: NEzequiel Garcia <ezequiel@vanguardiasur.com.ar>
      Reviewed-by: NEzequiel Garcia <ezequiel@vanguardiasur.com.ar>
      9ff08979
    • R
      UBI: rename_volumes: Use UBI_METAONLY · 892abde5
      Richard Weinberger 提交于
      By using UBI_METAONLY in rename_volumes() it is now possible to rename
      an UBI volume atomically while it is open for writing.
      This is useful for firmware upgrades.
      
      Cc: Ezequiel Garcia <ezequiel.garcia@free-electrons.com>
      Cc: Andrew Murray <amurray@embedded-bits.co.uk>
      Signed-off-by: NRichard Weinberger <richard@nod.at>
      Tested-by: NGuido Martínez <guido@vanguardiasur.com.ar>
      Reviewed-by: NGuido Martínez <guido@vanguardiasur.com.ar>
      Tested-by: NChristoph Fritz <chf.fritz@googlemail.com>
      Tested-by: NAndrew Murray <amurray@embedded-bits.co.uk>
      892abde5
    • R
      UBI: Implement UBI_METAONLY · fafdd2bf
      Richard Weinberger 提交于
      UBI_METAONLY is a new open mode for UBI volumes, it indicates
      that only meta data is being changed.
      Meta data in terms of UBI volumes means data which is stored in the
      UBI volume table but not on the volume itself.
      While it does not interfere with UBI_READONLY and UBI_READWRITE
      it is not allowed to use UBI_METAONLY together with UBI_EXCLUSIVE.
      
      Cc: Ezequiel Garcia <ezequiel.garcia@free-electrons.com>
      Cc: Andrew Murray <amurray@embedded-bits.co.uk>
      Signed-off-by: NRichard Weinberger <richard@nod.at>
      Tested-by: NGuido Martínez <guido@vanguardiasur.com.ar>
      Reviewed-by: NGuido Martínez <guido@vanguardiasur.com.ar>
      Tested-by: NChristoph Fritz <chf.fritz@googlemail.com>
      Tested-by: NAndrew Murray <amurray@embedded-bits.co.uk>
      fafdd2bf
  6. 07 11月, 2014 4 次提交
    • R
      UBI: Fix invalid vfree() · f38aed97
      Richard Weinberger 提交于
      The logic of vfree()'ing vol->upd_buf is tied to vol->updating.
      In ubi_start_update() vol->updating is set long before vmalloc()'ing
      vol->upd_buf. If we encounter a write failure in ubi_start_update()
      before vmalloc() the UBI device release function will try to vfree()
      vol->upd_buf because vol->updating is set.
      Fix this by allocating vol->upd_buf directly after setting vol->updating.
      
      Fixes:
      [   31.559338] UBI warning: vol_cdev_release: update of volume 2 not finished, volume is damaged
      [   31.559340] ------------[ cut here ]------------
      [   31.559343] WARNING: CPU: 1 PID: 2747 at mm/vmalloc.c:1446 __vunmap+0xe3/0x110()
      [   31.559344] Trying to vfree() nonexistent vm area (ffffc90001f2b000)
      [   31.559345] Modules linked in:
      [   31.565620]  0000000000000bba ffff88002a0cbdb0 ffffffff818f0497 ffff88003b9ba148
      [   31.566347]  ffff88002a0cbde0 ffffffff8156f515 ffff88003b9ba148 0000000000000bba
      [   31.567073]  0000000000000000 0000000000000000 ffff88002a0cbe88 ffffffff8156c10a
      [   31.567793] Call Trace:
      [   31.568034]  [<ffffffff818f0497>] dump_stack+0x4e/0x7a
      [   31.568510]  [<ffffffff8156f515>] ubi_io_write_vid_hdr+0x155/0x160
      [   31.569084]  [<ffffffff8156c10a>] ubi_eba_write_leb+0x23a/0x870
      [   31.569628]  [<ffffffff81569b36>] vol_cdev_write+0x226/0x380
      [   31.570155]  [<ffffffff81179265>] vfs_write+0xb5/0x1f0
      [   31.570627]  [<ffffffff81179f8a>] SyS_pwrite64+0x6a/0xa0
      [   31.571123]  [<ffffffff818fde12>] system_call_fastpath+0x16/0x1b
      
      Cc: <stable@vger.kernel.org>
      Signed-off-by: NRichard Weinberger <richard@nod.at>
      Signed-off-by: NArtem Bityutskiy <artem.bityutskiy@linux.intel.com>
      f38aed97
    • R
      UBI: Fix double free after do_sync_erase() · aa5ad3b6
      Richard Weinberger 提交于
      If the erase worker is unable to erase a PEB it will
      free the ubi_wl_entry itself.
      The failing ubi_wl_entry must not free()'d again after
      do_sync_erase() returns.
      
      Cc: <stable@vger.kernel.org>
      Signed-off-by: NRichard Weinberger <richard@nod.at>
      Signed-off-by: NArtem Bityutskiy <artem.bityutskiy@linux.intel.com>
      aa5ad3b6
    • R
      UBI: vtbl: Use ubi_eba_atomic_leb_change() · b81000b6
      Richard Weinberger 提交于
      This is more a cosmetic change than a fix.
      By using ubi_eba_atomic_leb_change()
      we can guarantee that the first VTBL record is always
      correct and we don't really need the second one anymore.
      But we have to keep the second one to not break anything.
      
      Artem: add a comment
      Signed-off-by: NRichard Weinberger <richard@nod.at>
      Signed-off-by: NArtem Bityutskiy <artem.bityutskiy@linux.intel.com>
      b81000b6
    • T
      UBI: Extend UBI layer debug/messaging capabilities · 32608703
      Tanya Brokhman 提交于
      If there is more then one UBI device mounted, there is no way to
      distinguish between messages from different UBI devices.
      Add device number to all ubi layer message types.
      
      The R/O block driver messages were replaced by pr_* since
      ubi_device structure is not used by it.
      
      Amended a bit by Artem.
      Signed-off-by: NTanya Brokhman <tlinder@codeaurora.org>
      Signed-off-by: NArtem Bityutskiy <artem.bityutskiy@linux.intel.com>
      32608703
  7. 03 10月, 2014 1 次提交
  8. 30 9月, 2014 1 次提交
  9. 26 9月, 2014 2 次提交
  10. 24 9月, 2014 1 次提交
  11. 19 9月, 2014 2 次提交
  12. 17 9月, 2014 3 次提交
    • E
      UBI: Dispatch update notification if the volume is updated · fda322a1
      Ezequiel Garcia 提交于
      The UBI_IOCVOLUP ioctl is used to start an update and also to
      truncate a volume. In the first case, a "volume updated" notification
      is dispatched when the update is done.
      
      This commit adds the "volume updated" notification to be also sent when
      the volume is truncated. This is required for UBI block and gluebi to get
      notified about the new volume size.
      Signed-off-by: NEzequiel Garcia <ezequiel.garcia@free-electrons.com>
      Signed-off-by: NArtem Bityutskiy <artem.bityutskiy@linux.intel.com>
      Cc: stable@vger.kernel.org # v3.15+
      fda322a1
    • E
      UBI: block: Add support for the UBI_VOLUME_UPDATED notification · 06d9c290
      Ezequiel Garcia 提交于
      Static volumes can change its 'used_bytes' when they get updated,
      and so the block interface must listen to the UBI_VOLUME_UPDATED
      notification to resize the block device accordingly.
      Signed-off-by: NEzequiel Garcia <ezequiel.garcia@free-electrons.com>
      Signed-off-by: NArtem Bityutskiy <artem.bityutskiy@linux.intel.com>
      Cc: stable@vger.kernel.org # v3.15+
      06d9c290
    • E
      UBI: block: Fix block device size setting · 978d6496
      Ezequiel Garcia 提交于
      We are currently taking the block device size from the ubi_volume_info.size
      field. However, this is not the amount of data in the volume, but the
      number of reserved physical eraseblocks, and hence leads to an incorrect
      representation of the volume.
      
      In particular, this produces I/O errors on static volumes as the block
      interface may attempt to read unmapped PEBs:
      
      $ cat /dev/ubiblock0_0 > /dev/null
      UBI error: ubiblock_read_to_buf: ubiblock0_0 ubi_read error -22
      end_request: I/O error, dev ubiblock0_0, sector 9536
      Buffer I/O error on device ubiblock0_0, logical block 2384
      [snip]
      
      Fix this by using the ubi_volume_info.used_bytes field which is set to the
      actual number of data bytes for both static and dynamic volumes.
      
      While here, improve the error message to be less stupid and more useful:
      UBI error: ubiblock_read_to_buf: ubiblock0_1 ubi_read error -9 on LEB=0, off=15872, len=512
      
      It's worth noticing that the 512-byte sector representation of the volume
      is only correct if the volume size is multiple of 512-bytes. This is true for
      virtually any NAND device, given eraseblocks and pages are 512-byte multiple
      and hence so is the LEB size.
      
      Artem: tweak the error message and make it look more like other UBI error
      messages.
      
      Fixes: 9d54c8a3 ("UBI: R/O block driver on top of UBI volumes")
      Signed-off-by: NEzequiel Garcia <ezequiel.garcia@free-electrons.com>
      Signed-off-by: NArtem Bityutskiy <artem.bityutskiy@linux.intel.com>
      Cc: stable@vger.kernel.org # v3.15+
      978d6496