linux-stable-rt/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
..
Kconfig
Makefile
budget.c
commit.c
compress.c
debug.c
debug.h UBIFS: fix compilation warnings when compiling with gcc 4.5 2011-04-13 11:59:09 +03:00
dir.c
file.c UBIFS: fix oops when R/O file-system is fsync'ed 2011-04-13 10:43:32 +03:00
find.c
gc.c
io.c
ioctl.c
journal.c
key.h
log.c
lprops.c
lpt.c
lpt_commit.c
master.c
misc.h
orphan.c
recovery.c UBIFS: fix master node recovery 2011-04-21 15:27:21 +03:00
replay.c
sb.c
scan.c
shrinker.c
super.c UBIFS: fix false assertion warning in case of I/O failures 2011-04-21 15:27:12 +03:00
tnc.c
tnc_commit.c
tnc_misc.c
ubifs-media.h
ubifs.h
xattr.c