linux-stable/drivers/mtd/ubi
Sebastian Andrzej Siewior 6afaf8a484 UBI: flush wl before clearing update marker
ubiupdatevol -t does the following:
- ubi_start_update()
  - set_update_marker()
  - for all LEBs ubi_eba_unmap_leb()
  - clear_update_marker()
  - ubi_wl_flush()

ubi_wl_flush() physically erases all PEB, once it returns all PEBs are
empty. clear_update_marker() has the update marker written after return.
If there is a power cut between the last two functions then the UBI
volume has no longer the "update" marker set and may have some valid
LEBs while some of them may be gone.
If that volume in question happens to be a UBIFS volume, then mount
will fail with

|UBIFS error (pid 1361): ubifs_read_node: bad node type (255 but expected 6)
|UBIFS error (pid 1361): ubifs_read_node: bad node at LEB 0:0
|Not a node, first 24 bytes:
|00000000: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff

if there is at least one valid LEB and the wear-leveling worker managed
to clear LEB 0.

The patch waits for the wl worker to finish prior clearing the "update"
marker on flash. The two new LEB which are scheduled for erasing after
clear_update_marker() should not matter because they are only visible to
UBI.

Signed-off-by: Sebastian Andrzej Siewior <sebastian@breakpoint.cc>
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
Cc: stable@kernel.org
2009-12-04 07:47:11 +02:00
..
build.c UBI: fix check on unsigned long 2009-10-20 10:13:49 +03:00
cdev.c UBI: remove built-in gluebi 2009-06-02 13:53:35 +03:00
debug.c UBI: introduce flash dump helper 2009-08-14 20:02:20 +03:00
debug.h UBI: introduce flash dump helper 2009-08-14 20:02:20 +03:00
eba.c trivial: fix typo "to to" in multiple files 2009-09-21 15:14:55 +02:00
gluebi.c UBI: gluebi: initialize ubi_num field 2009-07-15 11:30:55 +03:00
io.c UBI: improve NOR flash erasure quirk 2009-08-14 20:02:20 +03:00
kapi.c UBI: Add ubi_open_volume_path 2009-11-24 08:18:54 +02:00
Kconfig UBI: make gluebi a separate module 2009-06-03 17:45:23 +03:00
Kconfig.debug UBI: allow direct user-space I/O 2009-01-27 16:54:41 +02:00
Makefile UBI: make gluebi a separate module 2009-06-03 17:45:23 +03:00
misc.c UBI: avoid unnecessary division operations 2008-07-24 13:32:54 +03:00
scan.c UBI: fix backward compatibility 2009-10-20 10:13:04 +03:00
scan.h UBI: fix backward compatibility 2009-10-20 10:13:04 +03:00
ubi-media.h UBI: add image sequence number to EC header 2009-07-05 18:47:07 +03:00
ubi.h Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jikos/trivial 2009-09-22 07:51:45 -07:00
upd.c UBI: flush wl before clearing update marker 2009-12-04 07:47:11 +02:00
vmt.c UBI: remove built-in gluebi 2009-06-02 13:53:35 +03:00
vtbl.c trivial: fix then -> than typos in comments and documentation 2009-01-06 11:28:06 +01:00
wl.c UBI: remove bogus debugging checks 2009-07-05 18:47:05 +03:00