]> git.baikalelectronics.ru Git - kernel.git/commit
UBIFS: fix master node recovery
authorAnatolij Gustschin <agust@denx.de>
Thu, 7 Jul 2011 10:25:02 +0000 (12:25 +0200)
committerArtem Bityutskiy <dedekind1@gmail.com>
Fri, 8 Jul 2011 03:53:18 +0000 (06:53 +0300)
commit367be7bbac52832b78acfb9093bbf123e7bc5d62
treedafe4e1a099f666e1672a2a228f25598955bfc96
parent4ba17aeb6eeb5d392e0d8e6aeb3115e5951dc50c
UBIFS: fix master node recovery

When the 1st LEB was unmapped and written but 2nd LEB not,
the master node recovery doesn't succeed after power cut.
We see following error when mounting UBIFS partition on NOR
flash:

UBIFS error (pid 1137): ubifs_recover_master_node: failed to recover master node

Correct 2nd master node offset check is needed to fix the
problem. If the 2nd master node is at the end in the 2nd LEB,
first master node is used for recovery. When checking for this
condition we should check whether the master node is exactly at
the end of the LEB (without remaining empty space) or whether
it is followed by an empty space less than the master node size.

Artem: when the error happened, offs2 = 261120, sz = 512, c->leb_size = 262016.

Signed-off-by: Anatolij Gustschin <agust@denx.de>
Signed-off-by: Artem Bityutskiy <dedekind1@gmail.com>
fs/ubifs/recovery.c