linux/fs/ubifs
Artem Bityutskiy 6e0d9fd38b UBIFS: fix master node recovery
This patch fixes the following symptoms:
1. Unmount UBIFS cleanly.
2. Start mounting UBIFS R/W and have a power cut immediately
3. Start mounting UBIFS R/O, this succeeds
4. Try to re-mount UBIFS R/W - this fails immediately or later on,
   because UBIFS will write the master node to the flash area
   which has been written before.

The analysis of the problem:

1. UBIFS is unmounted cleanly, both copies of the master node are clean.
2. UBIFS is being mounter R/W, starts changing master node copy 1, and
   a power cut happens. The copy N1 becomes corrupted.
3. UBIFS is being mounted R/O. It notices the copy N1 is corrupted and
   reads copy N2. Copy N2 is clean.
4. Because of R/O mode, UBIFS cannot recover copy 1.
5. The mount code (ubifs_mount()) sees that the master node is clean,
   so it decides that no recovery is needed.
6. We are re-mounting R/W. UBIFS believes no recovery is needed and
   starts updating the master node, but copy N1 is still corrupted
   and was not recovered!

Fix this problem by marking the master node as dirty every time we
recover it and we are in R/O mode. This forces further recovery and
the UBIFS cleans-up the corruptions and recovers the copy N1 when
re-mounting R/W later.

Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
Cc: stable@kernel.org
2011-04-21 15:27:21 +03:00
..
budget.c Fix common misspellings 2011-03-31 11:26:23 -03:00
commit.c UBIFS: do not read flash unnecessarily 2011-04-05 10:39:40 +03:00
compress.c UBIFS: fix sparse warnings 2008-12-31 14:13:24 +02:00
debug.c UBIFS: fix debugging failure in dbg_check_space_info 2011-04-05 11:07:37 +03:00
debug.h UBIFS: fix compilation warnings when compiling with gcc 4.5 2011-04-13 11:59:09 +03:00
dir.c fs: Remove i_nlink check from file system link callback 2011-03-15 02:21:44 -04:00
file.c UBIFS: fix oops when R/O file-system is fsync'ed 2011-04-13 10:43:32 +03:00
find.c UBIFS: improve find function interface 2009-03-08 13:29:09 +02:00
gc.c UBIFS: introduce new flags for RO mounts 2010-09-19 21:07:58 +03:00
io.c UBIFS: use max_write_size for write-buffers 2011-03-08 10:12:49 +02:00
ioctl.c userns: rename is_owner_or_cap to inode_owner_or_capable 2011-03-23 19:47:13 -07:00
journal.c UBIFS: handle allocation failures in UBIFS write path 2011-03-11 10:52:07 +02:00
Kconfig UBIFS: do not select KALLSYMS_ALL 2011-04-05 10:45:45 +03:00
key.h UBIFS: mark unused key objects as invalid 2010-08-30 10:19:08 +03:00
log.c UBIFS: introduce new flags for RO mounts 2010-09-19 21:07:58 +03:00
lprops.c UBIFS: use GFP_NOFS properly 2011-03-24 16:14:26 +02:00
lpt_commit.c UBIFS: use GFP_NOFS properly 2011-03-24 16:14:26 +02:00
lpt.c UBIFS: fix oops on error path in read_pnode 2011-04-05 10:40:31 +03:00
Makefile
master.c UBIFS: introduce new flags for RO mounts 2010-09-19 21:07:58 +03:00
misc.h UBIFS: introduce new flags for RO mounts 2010-09-19 21:07:58 +03:00
orphan.c UBIFS: use GFP_NOFS properly 2011-03-24 16:14:26 +02:00
recovery.c UBIFS: fix master node recovery 2011-04-21 15:27:21 +03:00
replay.c UBIFS: do not allocate unneeded scan buffer 2010-10-21 11:15:19 +03:00
sb.c UBIFS: introduce new flags for RO mounts 2010-09-19 21:07:58 +03:00
scan.c UBIFS: remove double semicolon 2011-02-06 15:08:02 +02:00
shrinker.c UBIFS: introduce new flags for RO mounts 2010-09-19 21:07:58 +03:00
super.c UBIFS: fix false assertion warning in case of I/O failures 2011-04-21 15:27:12 +03:00
tnc_commit.c UBIFS: do not print scary error messages needlessly 2009-09-10 12:06:47 +03:00
tnc_misc.c UBIFS: correct key comparison 2008-09-30 11:12:57 +03:00
tnc.c UBIFS: introduce mounting flag 2011-01-17 23:24:30 +02:00
ubifs-media.h UBIFS: define journal head numbers in ubifs-media.h 2009-09-15 14:45:35 +03:00
ubifs.h UBIFS: handle allocation failures in UBIFS write path 2011-03-11 10:52:07 +02:00
xattr.c fs: export empty_aops 2011-04-05 23:51:48 +02:00