summaryrefslogtreecommitdiff
path: root/drivers/mtd/ubi/fastmap.c
AgeCommit message (Collapse)Author
2015-09-01UBI: Fastmap: Set used_ebs only for static volumesRichard Weinberger
If we set it for dynamic ones we might confuse various self checks. Signed-off-by: Richard Weinberger <richard@nod.at>
2015-09-01UBI: Fastmap: Fix leb_count unbalanceRichard Weinberger
If a LEB is unmapped we have to decrement leb_count as well. Signed-off-by: Richard Weinberger <richard@nod.at>
2015-09-01UBI: Fastmap: Switch to ro mode if invalidate_fastmap() failsRichard Weinberger
We have to switch to ro mode to guarantee that upon next UBI attach all data is consistent. Signed-off-by: Richard Weinberger <richard@nod.at>
2015-09-01UBI: Fastmap: Remove eba_orphans logicRichard Weinberger
This logic is in vain as we treat protected PEBs also as used, so this case must not happen. If a PEB is found which is in the EBA table but not known as used has to be issued as fatal error. Signed-off-by: Richard Weinberger <richard@nod.at>
2015-09-01UBI: Fastmap: Remove bogus ubi_assert()Richard Weinberger
It is legal to have PEBs left in the used list. This can happen if UBI copies a PEB and a powercut happens between writing a new fastmap and adding this PEB into the EBA table. In this case the old PEB will be used. Signed-off-by: Richard Weinberger <richard@nod.at>
2015-09-01UBI: Fastmap: Fix memory leak while attachingRichard Weinberger
Currently we leak a few ubi_ainf_pebs while attaching. Signed-off-by: Richard Weinberger <richard@nod.at>
2015-09-01UBI: Fastmap: Don't allocate new ubi_wl_entry objectsRichard Weinberger
There is no need to allocate new ones every time, we can reuse the existing ones. This makes the code cleaner and more easy to follow. Signed-off-by: Richard Weinberger <richard@nod.at> Reviewed-by: Tanya Brokhman <tlinder@codeaurora.org> Reviewed-by: Guido Martínez <guido@vanguardiasur.com.ar>
2015-09-01UBI: Fastmap: Care about the protection queueRichard 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: Richard Weinberger <richard@nod.at> Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
2015-09-01UBI: Fastmap: Calc fastmap size correctlyRichard Weinberger
We need to add fm_sb too. Signed-off-by: Richard Weinberger <richard@nod.at> Reviewed-by: Tanya Brokhman <tlinder@codeaurora.org> Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
2015-09-01UBI: add missing kmem_cache_free() in process_pool_aeb error pathRichard Genoud
I ran into this error after a ubiupdatevol, because I forgot to backport e9110361a9a4 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: Richard Genoud <richard.genoud@gmail.com> Cc: stable <stable@vger.kernel.org> # 3.10+
2015-09-01UBI: fastmap: do not miss bit-flipsBrian Norris
The return value from 'ubi_io_read_ec_hdr()' was stored in 'err', not in 'ret'. This fix makes sure Fastmap-enabled UBI does not miss bit-flip while reading EC headers, events and scrubs the affected PEBs. This issue was reported by Coverity Scan. Artem: improved the commit message. Signed-off-by: Brian Norris <computersforpeace@gmail.com> Acked-by: Richard Weinberger <richard@nod.at> Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
2015-09-01UBI: fix the volumes tree sorting criteriaHeiko Schocher
Commig "604b592 UBI: fix rb_tree node comparison in add_map" broke fastmap backward compatibility and older fastmap images cannot be mounted anymore. The reason is that it changes the volumes RB-tree sorting criteria. This patch fixes the problem. Artem: re-write the commit message Signed-off-by: Heiko Schocher <hs@denx.de> Acked-by: Richard Weinberger <richard@nod.at> Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
2015-09-01UBI: fix rb_tree node comparison in add_mapMike Snitzer
The comparisons used in add_vol() shouldn't be identical. Pretty sure the following is correct but it is completely untested. Signed-off-by: Mike Snitzer <snitzer@redhat.com> Acked-by: Richard Weinberger <richard@nod.at> Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
2014-09-16kbuild: force to define __UBOOT__ in all the C sourcesMasahiro Yamada
U-Boot has imported various source files from other projects, mostly Linux. Something like #ifdef __UBOOT__ [ modification for U-Boot ] #else [ original code ] #endif is an often used strategy for clarification of adjusted parts, that is, easier re-sync in future. Instead of defining __UBOOT__ in each source file, passing it from the top Makefile would be easier. Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com> Acked-by: Marek Vasut <marex@denx.de> Acked-by: Heiko Schocher <hs@denx.de>
2014-08-25mtd, ubi, ubifs: resync with Linux-3.14Heiko Schocher
resync ubi subsystem with linux: commit 455c6fdbd219161bd09b1165f11699d6d73de11c Author: Linus Torvalds <torvalds@linux-foundation.org> Date: Sun Mar 30 20:40:15 2014 -0700 Linux 3.14 A nice side effect of this, is we introduce UBI Fastmap support to U-Boot. Signed-off-by: Heiko Schocher <hs@denx.de> Signed-off-by: Tom Rini <trini@ti.com> Cc: Marek Vasut <marex@denx.de> Cc: Sergey Lapin <slapin@ossfans.org> Cc: Scott Wood <scottwood@freescale.com> Cc: Joerg Krause <jkrause@posteo.de>