1. 03 10月, 2016 10 次提交
  2. 30 7月, 2016 12 次提交
  3. 23 6月, 2016 1 次提交
    • R
      ubi: Make recover_peb power cut aware · 972228d8
      Richard Weinberger 提交于
      recover_peb() was never power cut aware,
      if a power cut happened right after writing the VID header
      upon next attach UBI would blindly use the new partial written
      PEB and all data from the old PEB is lost.
      
      In order to make recover_peb() power cut aware, write the new
      VID with a proper crc and copy_flag set such that the UBI attach
      process will detect whether the new PEB is completely written
      or not.
      We cannot directly use ubi_eba_atomic_leb_change() since we'd
      have to unlock the LEB which is facing a write error.
      
      Cc: stable@vger.kernel.org
      Reported-by: NJörg Pfähler <pfaehler@isse.de>
      Reviewed-by: NJörg Pfähler <pfaehler@isse.de>
      Signed-off-by: NRichard Weinberger <richard@nod.at>
      972228d8
  4. 14 6月, 2016 3 次提交
  5. 24 5月, 2016 7 次提交
    • 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
    • H
      UBI: Set free_count to zero before walking through erase list · 73b0cd57
      Heiko Schocher 提交于
      Set free_count to zero before walking through ai->erase list
      in wl_init().
      
      Found in U-Boot as U-Boot has no workqueue/threads, it immediately
      calls erase_worker(), which increase for each erased block
      free_count. Without this patch, free_count gets after
      this initialized to zero in wl_init(), so the free_count
      variable always has the maybe wrong value 0 in U-Boot.
      Signed-off-by: NHeiko Schocher <hs@denx.de>
      Reviewed-by: NBoris Brezillon <boris.brezillon@free-electrons.com>
      Signed-off-by: NRichard Weinberger <richard@nod.at>
      73b0cd57
    • D
      UBI: Silence an unintialized variable warning · 24663e72
      Dan Carpenter 提交于
      My static checker complains that "val" is uninitialized when kstrtoint()
      fails.
      Signed-off-by: NDan Carpenter <dan.carpenter@oracle.com>
      Signed-off-by: NRichard Weinberger <richard@nod.at>
      24663e72
    • D
      UBI: Clean up return in ubi_remove_volume() · fadb3665
      Dan Carpenter 提交于
      My static checker says that "err" can be uninitialized if
      "vol->reserved_pebs" is <= 0.  I don't think that can happen but
      returning a literal is cleaner anyway.
      Signed-off-by: NDan Carpenter <dan.carpenter@oracle.com>
      Signed-off-by: NRichard Weinberger <richard@nod.at>
      fadb3665
    • Z
      960b35d0
    • R
      UBI: Don't read back all data in ubi_eba_copy_leb() · 1e0a74f1
      Richard Weinberger 提交于
      Drop this paranoia check from the old days.
      If our MTD driver or the flash is so bad that we even cannot
      trust it to write data we have bigger problems.
      
      If one really does not trust the flash and wants write-verify
      she can enable UBI io checks using debugfs.
      Signed-off-by: NRichard Weinberger <richard@nod.at>
      1e0a74f1
    • E
      UBI: Add ro-mode sysfs attribute · 525bab71
      Ezequiel Garcia 提交于
      On serious situations, UBI may detect serious device corruption,
      and switch to read-only mode to protect the data and allow debugging.
      This commit exposes this ro-mode on sysfs, so it can be obtained
      by userspace tools.
      Signed-off-by: NEzequiel Garcia <ezequiel@vanguardiasur.com.ar>
      Signed-off-by: NRichard Weinberger <richard@nod.at>
      525bab71
  6. 28 3月, 2016 2 次提交
  7. 21 3月, 2016 1 次提交
  8. 06 3月, 2016 1 次提交
  9. 23 1月, 2016 1 次提交
    • A
      wrappers for ->i_mutex access · 5955102c
      Al Viro 提交于
      parallel to mutex_{lock,unlock,trylock,is_locked,lock_nested},
      inode_foo(inode) being mutex_foo(&inode->i_mutex).
      
      Please, use those for access to ->i_mutex; over the coming cycle
      ->i_mutex will become rwsem, with ->lookup() done with it held
      only shared.
      Signed-off-by: NAl Viro <viro@zeniv.linux.org.uk>
      5955102c
  10. 10 1月, 2016 1 次提交
  11. 17 12月, 2015 1 次提交