1. 03 10月, 2016 5 次提交
  2. 30 7月, 2016 4 次提交
  3. 24 5月, 2016 1 次提交
    • R
      UBI: Fix static volume checks when Fastmap is used · 1900149c
      Richard Weinberger 提交于
      Ezequiel reported that he's facing UBI going into read-only
      mode after power cut. It turned out that this behavior happens
      only when updating a static volume is interrupted and Fastmap is
      used.
      
      A possible trace can look like:
      ubi0 warning: ubi_io_read_vid_hdr [ubi]: no VID header found at PEB 2323, only 0xFF bytes
      ubi0 warning: ubi_eba_read_leb [ubi]: switch to read-only mode
      CPU: 0 PID: 833 Comm: ubiupdatevol Not tainted 4.6.0-rc2-ARCH #4
      Hardware name: SAMSUNG ELECTRONICS CO., LTD. 300E4C/300E5C/300E7C/NP300E5C-AD8AR, BIOS P04RAP 10/15/2012
      0000000000000286 00000000eba949bd ffff8800c45a7b38 ffffffff8140d841
      ffff8801964be000 ffff88018eaa4800 ffff8800c45a7bb8 ffffffffa003abf6
      ffffffff850e2ac0 8000000000000163 ffff8801850e2ac0 ffff8801850e2ac0
      Call Trace:
      [<ffffffff8140d841>] dump_stack+0x63/0x82
      [<ffffffffa003abf6>] ubi_eba_read_leb+0x486/0x4a0 [ubi]
      [<ffffffffa00453b3>] ubi_check_volume+0x83/0xf0 [ubi]
      [<ffffffffa0039d97>] ubi_open_volume+0x177/0x350 [ubi]
      [<ffffffffa00375d8>] vol_cdev_open+0x58/0xb0 [ubi]
      [<ffffffff8124b08e>] chrdev_open+0xae/0x1d0
      [<ffffffff81243bcf>] do_dentry_open+0x1ff/0x300
      [<ffffffff8124afe0>] ? cdev_put+0x30/0x30
      [<ffffffff81244d36>] vfs_open+0x56/0x60
      [<ffffffff812545f4>] path_openat+0x4f4/0x1190
      [<ffffffff81256621>] do_filp_open+0x91/0x100
      [<ffffffff81263547>] ? __alloc_fd+0xc7/0x190
      [<ffffffff812450df>] do_sys_open+0x13f/0x210
      [<ffffffff812451ce>] SyS_open+0x1e/0x20
      [<ffffffff81a99e32>] entry_SYSCALL_64_fastpath+0x1a/0xa4
      
      UBI checks static volumes for data consistency and reads the
      whole volume upon first open. If the volume is found erroneous
      users of UBI cannot read from it, but another volume update is
      possible to fix it. The check is performed by running
      ubi_eba_read_leb() on every allocated LEB of the volume.
      For static volumes ubi_eba_read_leb() computes the checksum of all
      data stored in a LEB. To verify the computed checksum it has to read
      the LEB's volume header which stores the original checksum.
      If the volume header is not found UBI treats this as fatal internal
      error and switches to RO mode. If the UBI device was attached via a
      full scan the assumption is correct, the volume header has to be
      present as it had to be there while scanning to get known as mapped.
      If the attach operation happened via Fastmap the assumption is no
      longer correct. When attaching via Fastmap UBI learns the mapping
      table from Fastmap's snapshot of the system state and not via a full
      scan. It can happen that a LEB got unmapped after a Fastmap was
      written to the flash. Then UBI can learn the LEB still as mapped and
      accessing it returns only 0xFF bytes. As UBI is not a FTL it is
      allowed to have mappings to empty PEBs, it assumes that the layer
      above takes care of LEB accounting and referencing.
      UBIFS does so using the LEB property tree (LPT).
      For static volumes UBI blindly assumes that all LEBs are present and
      therefore special actions have to be taken.
      
      The described situation can happen when updating a static volume is
      interrupted, either by a user or a power cut.
      The volume update code first unmaps all LEBs of a volume and then
      writes LEB by LEB. If the sequence of operations is interrupted UBI
      detects this either by the absence of LEBs, no volume header present
      at scan time, or corrupted payload, detected via checksum.
      In the Fastmap case the former method won't trigger as no scan
      happened and UBI automatically thinks all LEBs are present.
      Only by reading data from a LEB it detects that the volume header is
      missing and incorrectly treats this as fatal error.
      To deal with the situation ubi_eba_read_leb() from now on checks
      whether we attached via Fastmap and handles the absence of a
      volume header like a data corruption error.
      This way interrupted static volume updates will correctly get detected
      also when Fastmap is used.
      
      Cc: <stable@vger.kernel.org>
      Reported-by: NEzequiel Garcia <ezequiel@vanguardiasur.com.ar>
      Tested-by: NEzequiel Garcia <ezequiel@vanguardiasur.com.ar>
      Signed-off-by: NRichard Weinberger <richard@nod.at>
      1900149c
  4. 07 11月, 2015 1 次提交
  5. 04 10月, 2015 1 次提交
  6. 03 6月, 2015 1 次提交
  7. 02 6月, 2015 3 次提交
  8. 27 3月, 2015 12 次提交
  9. 28 1月, 2015 1 次提交
  10. 07 11月, 2014 1 次提交
  11. 03 10月, 2014 1 次提交
  12. 16 9月, 2014 1 次提交
    • R
      UBI: add missing kmem_cache_free() in process_pool_aeb error path · 1bf1890e
      Richard Genoud 提交于
      I ran into this error after a ubiupdatevol, because I forgot to backport
      e9110361 UBI: fix the volumes tree sorting criteria.
      
      UBI error: process_pool_aeb: orphaned volume in fastmap pool
      UBI error: ubi_scan_fastmap: Attach by fastmap failed, doing a full scan!
      kmem_cache_destroy ubi_ainf_peb_slab: Slab cache still has objects
      CPU: 0 PID: 1 Comm: swapper Not tainted 3.14.18-00053-gf05cac8dbf85 #1
      [<c000d298>] (unwind_backtrace) from [<c000baa8>] (show_stack+0x10/0x14)
      [<c000baa8>] (show_stack) from [<c01b7a68>] (destroy_ai+0x230/0x244)
      [<c01b7a68>] (destroy_ai) from [<c01b8fd4>] (ubi_attach+0x98/0x1ec)
      [<c01b8fd4>] (ubi_attach) from [<c01ade90>] (ubi_attach_mtd_dev+0x2b8/0x868)
      [<c01ade90>] (ubi_attach_mtd_dev) from [<c038b510>] (ubi_init+0x1dc/0x2ac)
      [<c038b510>] (ubi_init) from [<c0008860>] (do_one_initcall+0x94/0x140)
      [<c0008860>] (do_one_initcall) from [<c037aadc>] (kernel_init_freeable+0xe8/0x1b0)
      [<c037aadc>] (kernel_init_freeable) from [<c02730ac>] (kernel_init+0x8/0xe4)
      [<c02730ac>] (kernel_init) from [<c00093f0>] (ret_from_fork+0x14/0x24)
      UBI: scanning is finished
      
      Freeing the cache in the error path fixes the Slab error.
      
      Tested on at91sam9g35 (3.14.18+fastmap backports)
      Signed-off-by: NRichard Genoud <richard.genoud@gmail.com>
      Cc: stable <stable@vger.kernel.org> # 3.10+
      1bf1890e
  13. 16 7月, 2014 1 次提交
  14. 01 7月, 2014 1 次提交
  15. 13 5月, 2014 1 次提交
  16. 04 2月, 2014 1 次提交
  17. 04 10月, 2013 4 次提交