aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAnatolij Gustschin <agust@denx.de>2011-07-07 06:25:02 -0400
committerArtem Bityutskiy <dedekind1@gmail.com>2011-07-07 23:53:18 -0400
commit19495f70d1ebcdc732dd3c94f5968a4bff198ae5 (patch)
treedafe4e1a099f666e1672a2a228f25598955bfc96
parenta7fa94a9fe26a4925914083a31b5387bca530eb1 (diff)
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>
-rw-r--r--fs/ubifs/recovery.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/fs/ubifs/recovery.c b/fs/ubifs/recovery.c
index 51bcf4227b29..af02790d9328 100644
--- a/fs/ubifs/recovery.c
+++ b/fs/ubifs/recovery.c
@@ -274,7 +274,8 @@ int ubifs_recover_master_node(struct ubifs_info *c)
274 if (cor1) 274 if (cor1)
275 goto out_err; 275 goto out_err;
276 mst = mst1; 276 mst = mst1;
277 } else if (offs1 == 0 && offs2 + sz >= c->leb_size) { 277 } else if (offs1 == 0 &&
278 c->leb_size - offs2 - sz < sz) {
278 /* 1st LEB was unmapped and written, 2nd not */ 279 /* 1st LEB was unmapped and written, 2nd not */
279 if (cor1) 280 if (cor1)
280 goto out_err; 281 goto out_err;