diff options
-rw-r--r-- | fs/ubifs/super.c | 29 |
1 files changed, 16 insertions, 13 deletions
diff --git a/fs/ubifs/super.c b/fs/ubifs/super.c index 1e40db740da9..6d357fd9c289 100644 --- a/fs/ubifs/super.c +++ b/fs/ubifs/super.c | |||
@@ -1282,17 +1282,24 @@ static int mount_ubifs(struct ubifs_info *c) | |||
1282 | if (err) | 1282 | if (err) |
1283 | goto out_master; | 1283 | goto out_master; |
1284 | 1284 | ||
1285 | init_constants_master(c); | ||
1286 | |||
1287 | if ((c->mst_node->flags & cpu_to_le32(UBIFS_MST_DIRTY)) != 0) { | 1285 | if ((c->mst_node->flags & cpu_to_le32(UBIFS_MST_DIRTY)) != 0) { |
1288 | ubifs_msg("recovery needed"); | 1286 | ubifs_msg("recovery needed"); |
1289 | c->need_recovery = 1; | 1287 | c->need_recovery = 1; |
1290 | if (!c->ro_mount) { | 1288 | } |
1291 | err = ubifs_recover_inl_heads(c, c->sbuf); | 1289 | |
1292 | if (err) | 1290 | init_constants_master(c); |
1293 | goto out_master; | 1291 | |
1294 | } | 1292 | if (c->need_recovery && !c->ro_mount) { |
1295 | } else if (!c->ro_mount) { | 1293 | err = ubifs_recover_inl_heads(c, c->sbuf); |
1294 | if (err) | ||
1295 | goto out_master; | ||
1296 | } | ||
1297 | |||
1298 | err = ubifs_lpt_init(c, 1, !c->ro_mount); | ||
1299 | if (err) | ||
1300 | goto out_master; | ||
1301 | |||
1302 | if (!c->ro_mount) { | ||
1296 | /* | 1303 | /* |
1297 | * Set the "dirty" flag so that if we reboot uncleanly we | 1304 | * Set the "dirty" flag so that if we reboot uncleanly we |
1298 | * will notice this immediately on the next mount. | 1305 | * will notice this immediately on the next mount. |
@@ -1300,13 +1307,9 @@ static int mount_ubifs(struct ubifs_info *c) | |||
1300 | c->mst_node->flags |= cpu_to_le32(UBIFS_MST_DIRTY); | 1307 | c->mst_node->flags |= cpu_to_le32(UBIFS_MST_DIRTY); |
1301 | err = ubifs_write_master(c); | 1308 | err = ubifs_write_master(c); |
1302 | if (err) | 1309 | if (err) |
1303 | goto out_master; | 1310 | goto out_lpt; |
1304 | } | 1311 | } |
1305 | 1312 | ||
1306 | err = ubifs_lpt_init(c, 1, !c->ro_mount); | ||
1307 | if (err) | ||
1308 | goto out_lpt; | ||
1309 | |||
1310 | err = dbg_check_idx_size(c, c->bi.old_idx_sz); | 1313 | err = dbg_check_idx_size(c, c->bi.old_idx_sz); |
1311 | if (err) | 1314 | if (err) |
1312 | goto out_lpt; | 1315 | goto out_lpt; |